Skip to content

Commit

Permalink
Add mondialrelay_fr vcr tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Sep 16, 2024
1 parent 605d0ee commit 8fde3e3
Show file tree
Hide file tree
Showing 7 changed files with 2,946 additions and 3 deletions.
Empty file.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions roulier/carriers/mondialrelay_fr/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2024 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from ....tests.conftest import * # noqa
72 changes: 72 additions & 0 deletions roulier/carriers/mondialrelay_fr/tests/test_mondialrelay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2024 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import pytest
from roulier import roulier
from ....helpers import merge


@pytest.fixture
def get_label_data(credentials, base_get_label_data):
return merge(
credentials["mondialrelay_fr"],
base_get_label_data,
{
"service": {
"product": "HOM",
"pickupMode": "REL",
"pickupSite": "AUTO",
"pickupCountry": "FR",
}
},
)


@pytest.fixture
def find_pickup_site_data(credentials, base_find_pickup_site_data):
return merge(
credentials["mondialrelay_fr"],
base_find_pickup_site_data,
)


@pytest.mark.vcr()
def test_mondialrelay_label(get_label_data):
rv = roulier.get("mondialrelay_fr", "get_label", get_label_data)
assert "parcels" in rv
assert "label" in rv["parcels"][0]
label = rv["parcels"][0]["label"]
assert label["name"] == "label_url"
assert label["type"] == "url"
assert label["data"].startswith("https://www.mondialrelay.com")


@pytest.mark.vcr()
def test_mondialrelay_label_return(get_label_data):
rv = roulier.get(
"mondialrelay_fr",
"get_label",
merge(
get_label_data,
{
"service": {
"product": "LCC",
},
},
),
)
assert "parcels" in rv
assert "label" in rv["parcels"][0]
label = rv["parcels"][0]["label"]
assert label["name"] == "label_url"
assert label["type"] == "url"
assert label["data"].startswith("https://www.mondialrelay.com")


@pytest.mark.vcr()
def test_mondialrelay_pickup_site(find_pickup_site_data):
rv = roulier.get("mondialrelay_fr", "find_pickup_site", find_pickup_site_data)
assert "sites" in rv
assert len(rv["sites"]) > 0
assert "name" in rv["sites"][0]
8 changes: 5 additions & 3 deletions roulier/tests/credentials_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"""Copy this file to credentials.py and fill in your test credentials"""

CREDENTIALS = {
"mondialrelay_fr": { # These are public test credentials
"login": "BDTEST13",
"password": "PrivateK",
"mondialrelay_fr": {
"auth": { # These are public test credentials
"login": "BDTEST13",
"password": "PrivateK",
}
},
}

0 comments on commit 8fde3e3

Please sign in to comment.