Skip to main content

oicp_kit/transport/
endpoint.rs

1//! The endpoint table: which service, at which version, on which path, in which direction.
2
3use core::fmt;
4
5use crate::types::{OperatorId, ProviderId};
6
7/// Which side of the roaming relationship a party is on.
8#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
9pub enum Role {
10    /// A Charge Point Operator.
11    Cpo,
12    /// An e-Mobility Provider.
13    Emp,
14}
15
16impl Role {
17    /// A short, stable slug.
18    #[must_use]
19    pub const fn as_str(self) -> &'static str {
20        match self {
21            Self::Cpo => "CPO",
22            Self::Emp => "EMP",
23        }
24    }
25
26    /// The other side.
27    #[must_use]
28    pub const fn counterpart(self) -> Self {
29        match self {
30            Self::Cpo => Self::Emp,
31            Self::Emp => Self::Cpo,
32        }
33    }
34}
35
36impl fmt::Display for Role {
37    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38        f.write_str(self.as_str())
39    }
40}
41
42/// What one operation means for one role.
43///
44/// # Why this is per role and not per operation
45///
46/// OICP proxies: `AuthorizeRemoteStart` is a request an **EMP sends** to Hubject *and* a request
47/// **a CPO receives** from Hubject, at the same path. A single "direction" on the operation can
48/// only be true for one of the two, and the answer a partner needs — *do I call this, or do I
49/// implement it?* — depends entirely on which role they are.
50///
51/// Each operation is therefore asked [`Operation::involvement`] for a role, and the answer is
52/// `None` for the ones that role takes no part in: a CPO has no `ProviderID` and never pulls EVSE
53/// data.
54#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
55pub enum Involvement {
56    /// You call Hubject. You are the client.
57    YouCall,
58    /// Hubject calls you: you implement this endpoint and register it in the Hubject portal. The
59    /// half most implementations forget — see [`server`](crate::server).
60    YouServe,
61}
62
63impl Involvement {
64    /// A short phrase for a listing.
65    #[must_use]
66    pub const fn as_str(self) -> &'static str {
67        match self {
68            Self::YouCall => "you -> Hubject",
69            Self::YouServe => "Hubject -> you",
70        }
71    }
72}
73
74impl fmt::Display for Involvement {
75    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
76        f.write_str(self.as_str())
77    }
78}
79
80/// The identifier that goes in an endpoint's path.
81///
82/// Hubject matches this against the partner's TLS client certificate, and answers a mismatch with
83/// [`Code::UnauthorizedAccess`](crate::types::Code::UnauthorizedAccess). It is therefore never
84/// normalised on the way out — see [`types::ids`](crate::types::EvseId).
85#[derive(Clone, Debug, PartialEq, Eq, Hash)]
86pub enum PathId {
87    /// An `{operatorID}` path segment.
88    Operator(OperatorId),
89    /// A `{providerID}` path segment.
90    Provider(ProviderId),
91}
92
93impl PathId {
94    /// The identifier as it goes into the URL — byte for byte as it arrived.
95    #[must_use]
96    pub fn as_str(&self) -> &str {
97        match self {
98            Self::Operator(id) => id.as_str(),
99            Self::Provider(id) => id.as_str(),
100        }
101    }
102}
103
104impl fmt::Display for PathId {
105    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
106        f.write_str(self.as_str())
107    }
108}
109
110impl From<OperatorId> for PathId {
111    fn from(id: OperatorId) -> Self {
112        Self::Operator(id)
113    }
114}
115
116impl From<ProviderId> for PathId {
117    fn from(id: ProviderId) -> Self {
118        Self::Provider(id)
119    }
120}
121
122/// Every OICP 2.3 operation, with the path and service version it lives at.
123///
124/// # Why services carry their own versions
125///
126/// OICP versions **services**, not the protocol: a "2.3 implementation" is `evsepush/v23` *and*
127/// `charging/v21` *and* `cdrmgmt/v22` *and* `reservation/v11` *and* `dynamicpricing/v10` *and*
128/// `notificationmgmt/v11`. Three of those did not change between OICP 2.2 and 2.3 at all.
129///
130/// This table is the one place in the crate that knows which is which. `cargo run -p xtask --
131/// endpoints --check` diffs it against the vendored OpenAPI documents, so a Hubject revision shows
132/// up as a failing CI job rather than as a silent 404 in production.
133#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
134#[non_exhaustive]
135pub enum Operation {
136    /// `eRoamingAuthorizeStart_V2.1` — CPO asks whether a driver may charge.
137    AuthorizeStart,
138    /// `eRoamingAuthorizeStop_V2.1` — CPO asks whether a session may stop.
139    AuthorizeStop,
140    /// `eRoamingAuthorizeRemoteStart_V2.1` — EMP starts a session; Hubject calls the CPO.
141    AuthorizeRemoteStart,
142    /// `eRoamingAuthorizeRemoteStop_V2.1` — EMP stops a session; Hubject calls the CPO.
143    AuthorizeRemoteStop,
144    /// `eRoamingChargeDetailRecord_V2.2` — CPO submits a CDR.
145    ChargeDetailRecord,
146    /// `eRoamingGetChargeDetailRecords_V2.2` — EMP retrieves CDRs.
147    GetChargeDetailRecords,
148    /// `eRoamingPushAuthenticationData_V2.1` — offline EMP uploads its card base.
149    PushAuthenticationData,
150    /// `eRoamingAuthorizeRemoteReservationStart_V1.1` — EMP reserves a spot.
151    AuthorizeRemoteReservationStart,
152    /// `eRoamingAuthorizeRemoteReservationStop_V1.1` — EMP releases a reservation.
153    AuthorizeRemoteReservationStop,
154    /// `eRoamingPushEvseData_V2.3` — CPO uploads static EVSE data.
155    PushEvseData,
156    /// `eRoamingPullEvseData_V2.3` — EMP downloads static EVSE data.
157    PullEvseData,
158    /// `eRoamingPushEvseStatus_V2.1` — CPO uploads dynamic EVSE status.
159    PushEvseStatus,
160    /// `eRoamingPullEvseStatus_V2.1` — EMP downloads dynamic EVSE status, in all three shapes.
161    PullEvseStatus,
162    /// `eRoamingPushPricingProductData_V1.0` — CPO uploads tariffs.
163    PushPricingProductData,
164    /// `eRoamingPullPricingProductData_V1.0` — EMP downloads tariffs.
165    PullPricingProductData,
166    /// `eRoamingPushEVSEPricing_V1.0` — CPO uploads per-EVSE pricing.
167    PushEvsePricing,
168    /// `eRoamingPullEVSEPricing_V1.0` — EMP downloads per-EVSE pricing.
169    PullEvsePricing,
170    /// `eRoamingChargingNotifications V1.1` — CPO reports session progress.
171    ChargingNotifications,
172}
173
174/// What the table knows about one operation.
175#[derive(Clone, Copy, Debug, PartialEq, Eq)]
176#[non_exhaustive]
177pub struct EndpointInfo {
178    /// The service family, e.g. `charging`.
179    pub service: &'static str,
180    /// The service's own version, e.g. `v21`.
181    pub version: &'static str,
182    /// The path, with `{operatorID}` or `{providerID}` still in it.
183    pub path_template: &'static str,
184    /// What this operation is for a CPO, or `None` if a CPO takes no part.
185    pub cpo: Option<Involvement>,
186    /// What this operation is for an EMP, or `None` if an EMP takes no part.
187    pub emp: Option<Involvement>,
188    /// Whether the response is a page rather than an acknowledgement.
189    pub paginated: bool,
190}
191
192/// `Calls` / `Serves` / `NoPart`, for the table's two role columns.
193macro_rules! involvement {
194    (Calls) => {
195        Some(Involvement::YouCall)
196    };
197    (Serves) => {
198        Some(Involvement::YouServe)
199    };
200    (NoPart) => {
201        None
202    };
203}
204
205macro_rules! endpoint_table {
206    ($( $op:ident => $service:literal, $version:literal, $path:literal, $cpo:ident, $emp:ident, $paginated:literal );* $(;)?) => {
207        impl Operation {
208            /// Every operation in OICP 2.3.
209            pub const ALL: &'static [Self] = &[ $( Self::$op ),* ];
210
211            /// The table entry for this operation.
212            #[must_use]
213            pub const fn info(self) -> EndpointInfo {
214                match self {
215                    $( Self::$op => EndpointInfo {
216                        service: $service,
217                        version: $version,
218                        path_template: $path,
219                        cpo: involvement!($cpo),
220                        emp: involvement!($emp),
221                        paginated: $paginated,
222                    }, )*
223                }
224            }
225        }
226    };
227}
228
229// The order matches the OpenAPI documents, so a diff against them reads naturally.
230endpoint_table! {
231    AuthorizeStart => "charging", "v21", "/charging/v21/operators/{operatorID}/authorize/start", Calls, Serves, false;
232    AuthorizeStop => "charging", "v21", "/charging/v21/operators/{operatorID}/authorize/stop", Calls, Serves, false;
233    AuthorizeRemoteStart => "charging", "v21", "/charging/v21/providers/{providerID}/authorize-remote/start", Serves, Calls, false;
234    AuthorizeRemoteStop => "charging", "v21", "/charging/v21/providers/{providerID}/authorize-remote/stop", Serves, Calls, false;
235    ChargeDetailRecord => "cdrmgmt", "v22", "/cdrmgmt/v22/operators/{operatorID}/charge-detail-record", Calls, Serves, false;
236    GetChargeDetailRecords => "cdrmgmt", "v22", "/cdrmgmt/v22/providers/{providerID}/get-charge-detail-records-request", NoPart, Calls, true;
237    PushAuthenticationData => "authdata", "v21", "/authdata/v21/providers/{providerID}/push-request", NoPart, Calls, false;
238    AuthorizeRemoteReservationStart => "reservation", "v11", "/reservation/v11/providers/{providerID}/reservation-start-request", Serves, Calls, false;
239    AuthorizeRemoteReservationStop => "reservation", "v11", "/reservation/v11/providers/{providerID}/reservation-stop-request", Serves, Calls, false;
240    PushEvseData => "evsepush", "v23", "/evsepush/v23/operators/{operatorID}/data-records", Calls, NoPart, false;
241    PullEvseData => "evsepull", "v23", "/evsepull/v23/providers/{providerID}/data-records", NoPart, Calls, true;
242    PushEvseStatus => "evsepush", "v21", "/evsepush/v21/operators/{operatorID}/status-records", Calls, NoPart, false;
243    PullEvseStatus => "evsepull", "v21", "/evsepull/v21/providers/{providerID}/status-records", NoPart, Calls, false;
244    PushPricingProductData => "dynamicpricing", "v10", "/dynamicpricing/v10/operators/{operatorID}/pricing-products", Calls, NoPart, false;
245    PullPricingProductData => "dynamicpricing", "v10", "/dynamicpricing/v10/providers/{providerID}/pricing-products", NoPart, Calls, false;
246    PushEvsePricing => "dynamicpricing", "v10", "/dynamicpricing/v10/operators/{operatorID}/evse-pricing", Calls, NoPart, false;
247    PullEvsePricing => "dynamicpricing", "v10", "/dynamicpricing/v10/providers/{providerID}/evse-pricing", NoPart, Calls, false;
248    ChargingNotifications => "notificationmgmt", "v11", "/notificationmgmt/v11/charging-notifications", Calls, Serves, false;
249}
250
251impl Operation {
252    /// The service family, e.g. `charging`.
253    #[must_use]
254    pub const fn service(self) -> &'static str {
255        self.info().service
256    }
257
258    /// The service's own version, e.g. `v21`.
259    #[must_use]
260    pub const fn version(self) -> &'static str {
261        self.info().version
262    }
263
264    /// The path with `{operatorID}` / `{providerID}` still in it.
265    #[must_use]
266    pub const fn path_template(self) -> &'static str {
267        self.info().path_template
268    }
269
270    /// Whether the answer is a page rather than an acknowledgement.
271    #[must_use]
272    pub const fn is_paginated(self) -> bool {
273        self.info().paginated
274    }
275
276    /// Whether `role` implements this operation rather than calling it.
277    ///
278    /// There is no role-free answer: `AuthorizeRemoteStart` is served by a CPO and called by an
279    /// EMP, at the same path. Asking without saying which side you are on is asking the wrong
280    /// question, which is why this takes a [`Role`].
281    #[must_use]
282    pub const fn is_served_by(self, role: Role) -> bool {
283        matches!(self.involvement(role), Some(Involvement::YouServe))
284    }
285
286    /// Whether this path takes an `{operatorID}` rather than a `{providerID}`.
287    #[must_use]
288    pub fn takes_operator_id(self) -> bool {
289        self.info().path_template.contains("{operatorID}")
290    }
291
292    /// What this operation is for `role`, or `None` when that role takes no part in it.
293    ///
294    /// This is the question a partner actually has — *do I call this, or do I implement it?* — and
295    /// it has different answers for the two roles at the same path. See [`Involvement`].
296    #[must_use]
297    pub const fn involvement(self, role: Role) -> Option<Involvement> {
298        match role {
299            Role::Cpo => self.info().cpo,
300            Role::Emp => self.info().emp,
301        }
302    }
303
304    /// Every operation `role` calls or serves, in table order.
305    #[must_use]
306    pub fn for_role(role: Role) -> Vec<Self> {
307        Self::ALL.iter().copied().filter(|op| op.involvement(role).is_some()).collect()
308    }
309
310    /// The identifier `role` puts in this path when it calls the operation.
311    ///
312    /// `None` when the operation has no identifier in its path, or when `role` does not call it.
313    #[must_use]
314    pub fn caller_path_id(self, role: Role, id: &str) -> Option<PathId> {
315        if self.involvement(role) != Some(Involvement::YouCall) || !self.path_template().contains('{') {
316            return None;
317        }
318        Some(if self.takes_operator_id() {
319            PathId::Operator(OperatorId::new_unchecked(id))
320        } else {
321            PathId::Provider(ProviderId::new_unchecked(id))
322        })
323    }
324
325    /// The path with `id` substituted in.
326    ///
327    /// The identifier goes in verbatim: Hubject compares it to the TLS client certificate as text.
328    ///
329    /// # Errors
330    ///
331    /// Returns [`EndpointError`] when `id` is the wrong kind for this path — a provider id in an
332    /// `{operatorID}` slot, or the reverse. That mismatch is `017 Unauthorized Access` in
333    /// production, so it is caught here instead.
334    pub fn path(self, id: &PathId) -> Result<String, EndpointError> {
335        let template = self.path_template();
336        match (id, self.takes_operator_id()) {
337            (PathId::Operator(_), true) => Ok(template.replace("{operatorID}", id.as_str())),
338            (PathId::Provider(_), false) if template.contains("{providerID}") => {
339                Ok(template.replace("{providerID}", id.as_str()))
340            }
341            // The notification endpoint has no id at all.
342            (_, false) if !template.contains('{') => Ok(template.to_owned()),
343            (PathId::Operator(_), false) => {
344                Err(EndpointError::WrongIdKind { operation: self, expected: "providerID" })
345            }
346            (PathId::Provider(_), true) => {
347                Err(EndpointError::WrongIdKind { operation: self, expected: "operatorID" })
348            }
349            _ => Err(EndpointError::WrongIdKind { operation: self, expected: "no id" }),
350        }
351    }
352
353    /// The full URL for this operation against `base`.
354    ///
355    /// # Errors
356    ///
357    /// As [`Operation::path`].
358    pub fn url(self, base: &str, id: &PathId) -> Result<String, EndpointError> {
359        Ok(format!("{}{}", base.trim_end_matches('/'), self.path(id)?))
360    }
361
362    /// Looks an operation up by its concrete path, for a server router.
363    #[must_use]
364    pub fn from_path(path: &str) -> Option<Self> {
365        Self::ALL.iter().copied().find(|op| path_matches(op.path_template(), path))
366    }
367}
368
369/// Whether a concrete path matches a template with `{…}` placeholders.
370fn path_matches(template: &str, path: &str) -> bool {
371    let mut t = template.split('/');
372    let mut p = path.trim_end_matches('/').split('/');
373    loop {
374        match (t.next(), p.next()) {
375            (None, None) => return true,
376            (Some(ts), Some(ps)) if ts.starts_with('{') && ts.ends_with('}') => {
377                if ps.is_empty() {
378                    return false;
379                }
380            }
381            (Some(ts), Some(ps)) if ts == ps => {}
382            _ => return false,
383        }
384    }
385}
386
387/// Why a URL could not be built.
388#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
389pub enum EndpointError {
390    /// The identifier is the wrong kind for this path.
391    #[error("{operation:?} takes a {expected} in its path, but the other kind of identifier was given")]
392    WrongIdKind {
393        /// The operation.
394        operation: Operation,
395        /// What the path wanted.
396        expected: &'static str,
397    },
398}
399
400/// Which Hubject environment to talk to.
401#[derive(Clone, Debug, PartialEq, Eq)]
402pub enum HubjectEnv {
403    /// The production brokering system, `https://service.hubject.com/api/oicp`.
404    Prod,
405    /// The QA system, `https://service-qa.hubject.com/api/oicp`. Where integration starts.
406    Qa,
407    /// A base URL of your own — a [`MockHubject`](crate::testkit::MockHubject), or a proxy.
408    Custom(String),
409}
410
411impl HubjectEnv {
412    /// The base URL, without a trailing slash.
413    #[must_use]
414    pub fn base_url(&self) -> &str {
415        match self {
416            Self::Prod => "https://service.hubject.com/api/oicp",
417            Self::Qa => "https://service-qa.hubject.com/api/oicp",
418            Self::Custom(url) => url.trim_end_matches('/'),
419        }
420    }
421
422    /// Whether this is the production system.
423    ///
424    /// Worth branching on before anything destructive: a `fullLoad` against `Prod` is not a
425    /// rehearsal.
426    #[must_use]
427    pub const fn is_production(&self) -> bool {
428        matches!(self, Self::Prod)
429    }
430}
431
432impl fmt::Display for HubjectEnv {
433    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
434        f.write_str(self.base_url())
435    }
436}
437
438#[cfg(test)]
439mod tests {
440    use super::*;
441
442    #[test]
443    fn the_table_covers_every_operation_exactly_once() {
444        assert_eq!(Operation::ALL.len(), 18);
445        let mut paths: Vec<_> = Operation::ALL.iter().map(|op| (op.path_template(), *op)).collect();
446        paths.sort_unstable();
447        let mut unique = paths.clone();
448        unique.dedup_by_key(|(p, _)| *p);
449        assert_eq!(paths.len(), unique.len(), "two operations share a path template");
450    }
451
452    #[test]
453    fn paths_carry_the_identifier_exactly_as_given() {
454        let op = Operation::PushEvseData;
455        // Hubject string-matches this against the certificate: `DE*ABC` must not become `DEABC`.
456        let id = PathId::Operator("DE*ABC".parse().unwrap());
457        assert_eq!(op.path(&id).unwrap(), "/evsepush/v23/operators/DE*ABC/data-records");
458
459        let packed = PathId::Operator("DEABC".parse().unwrap());
460        assert_eq!(op.path(&packed).unwrap(), "/evsepush/v23/operators/DEABC/data-records");
461    }
462
463    #[test]
464    fn the_wrong_kind_of_identifier_is_caught_locally() {
465        let provider = PathId::Provider("DE-DCB".parse().unwrap());
466        // PushEvseData wants an operatorID; this would be 017 Unauthorized Access in production.
467        let err = Operation::PushEvseData.path(&provider).unwrap_err();
468        assert!(matches!(err, EndpointError::WrongIdKind { expected: "operatorID", .. }));
469
470        let operator = PathId::Operator("DE*ABC".parse().unwrap());
471        assert!(Operation::PullEvseData.path(&operator).is_err());
472    }
473
474    #[test]
475    fn the_notification_endpoint_takes_no_identifier() {
476        let op = Operation::ChargingNotifications;
477        let id = PathId::Operator("DE*ABC".parse().unwrap());
478        assert_eq!(op.path(&id).unwrap(), "/notificationmgmt/v11/charging-notifications");
479    }
480
481    #[test]
482    fn routing_recovers_the_operation_from_a_concrete_path() {
483        assert_eq!(
484            Operation::from_path("/evsepush/v23/operators/DE*ABC/data-records"),
485            Some(Operation::PushEvseData)
486        );
487        assert_eq!(
488            Operation::from_path("/charging/v21/providers/DE-DCB/authorize-remote/start"),
489            Some(Operation::AuthorizeRemoteStart)
490        );
491        assert_eq!(Operation::from_path("/nope"), None);
492        // The two authorize paths differ only in their last segment.
493        assert_eq!(
494            Operation::from_path("/charging/v21/operators/DE*ABC/authorize/stop"),
495            Some(Operation::AuthorizeStop)
496        );
497    }
498
499    #[test]
500    fn what_a_partner_serves_depends_on_which_partner_they_are() {
501        // The same four paths, read from the two sides. `AuthorizeRemoteStart` is the pair that
502        // makes the point: an EMP calls it and a CPO implements it, at one path — so an operation
503        // cannot carry a single direction and be right about both.
504        assert_eq!(
505            Operation::ALL.iter().copied().filter(|op| op.is_served_by(Role::Cpo)).collect::<Vec<_>>(),
506            vec![
507                Operation::AuthorizeRemoteStart,
508                Operation::AuthorizeRemoteStop,
509                Operation::AuthorizeRemoteReservationStart,
510                Operation::AuthorizeRemoteReservationStop,
511            ]
512        );
513        assert_eq!(
514            Operation::ALL.iter().copied().filter(|op| op.is_served_by(Role::Emp)).collect::<Vec<_>>(),
515            vec![
516                Operation::AuthorizeStart,
517                Operation::AuthorizeStop,
518                Operation::ChargeDetailRecord,
519                Operation::ChargingNotifications,
520            ]
521        );
522    }
523
524    #[test]
525    fn the_role_that_calls_an_operation_is_the_role_whose_identifier_the_path_carries() {
526        // Not a coincidence worth relying on silently: a CPO only ever calls `{operatorID}` paths
527        // and an EMP only ever calls `{providerID}` ones, which is what makes `caller_path_id`
528        // able to pick the kind without being told.
529        for operation in Operation::ALL.iter().copied() {
530            if !operation.path_template().contains('{') {
531                continue;
532            }
533            let caller = if operation.involvement(Role::Cpo) == Some(Involvement::YouCall) {
534                Role::Cpo
535            } else {
536                Role::Emp
537            };
538            assert_eq!(
539                operation.involvement(caller),
540                Some(Involvement::YouCall),
541                "{operation:?} is called by neither role"
542            );
543            assert_eq!(
544                operation.takes_operator_id(),
545                caller == Role::Cpo,
546                "{operation:?} is called by {caller} but its path carries the other identifier"
547            );
548        }
549    }
550
551    #[test]
552    fn every_operation_involves_at_least_one_role() {
553        for operation in Operation::ALL.iter().copied() {
554            assert!(
555                operation.involvement(Role::Cpo).is_some() || operation.involvement(Role::Emp).is_some(),
556                "{operation:?} is in the table and belongs to nobody"
557            );
558        }
559        assert_eq!(Operation::for_role(Role::Cpo).len(), 12, "the CPO document's twelve endpoints");
560        assert_eq!(Operation::for_role(Role::Emp).len(), 14, "the EMP document's fourteen");
561    }
562
563    #[test]
564    fn only_the_two_big_pulls_are_paginated() {
565        let paginated: Vec<_> = Operation::ALL.iter().copied().filter(|op| op.is_paginated()).collect();
566        assert_eq!(paginated, vec![Operation::GetChargeDetailRecords, Operation::PullEvseData]);
567    }
568
569    #[test]
570    fn the_environments_have_the_urls_the_spec_gives() {
571        assert_eq!(HubjectEnv::Prod.base_url(), "https://service.hubject.com/api/oicp");
572        assert_eq!(HubjectEnv::Qa.base_url(), "https://service-qa.hubject.com/api/oicp");
573        assert!(HubjectEnv::Prod.is_production());
574        assert!(!HubjectEnv::Qa.is_production());
575        assert_eq!(HubjectEnv::Custom("http://localhost:8080/".into()).base_url(), "http://localhost:8080");
576    }
577
578    #[test]
579    fn urls_join_base_and_path_without_doubling_the_slash() {
580        let url = Operation::PullEvseData
581            .url(HubjectEnv::Qa.base_url(), &PathId::Provider("DE-DCB".parse().unwrap()))
582            .unwrap();
583        assert_eq!(url, "https://service-qa.hubject.com/api/oicp/evsepull/v23/providers/DE-DCB/data-records");
584    }
585}