-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
35 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1 @@ | ||
from . import test_controller | ||
from . import test_backend | ||
from . import test_cart | ||
from . import test_cart_item | ||
from . import test_address | ||
from . import test_product | ||
from . import test_sale | ||
from . import test_shopinvader_variant_binding_wizard | ||
from . import test_shopinvader_category_binding_wizard | ||
from . import test_customer | ||
from . import test_shopinvader_partner | ||
from . import test_res_partner | ||
from . import test_shopinvader_variant_seo_title | ||
from . import test_shopinvader_partner_binding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
# Copyright 2017 Akretion (http://www.akretion.com). | ||
# @author Sébastien BEAU <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
import unittest | ||
|
||
from uuid import uuid4 | ||
|
||
import requests | ||
from odoo.addons.server_environment import serv_config | ||
from odoo.exceptions import MissingError | ||
from odoo.tools import mute_logger | ||
|
||
from .common import ShopinvaderRestCase | ||
|
||
|
||
@unittest.skipIf( | ||
ShopinvaderRestCase.AUTH_API_KEY_NAME not in serv_config.sections(), | ||
"You must define an auth_api_key section '%s' into your configuration " | ||
"to run controller tests" % ShopinvaderRestCase.AUTH_API_KEY_NAME, | ||
) | ||
class ShopinvaderControllerCase(ShopinvaderRestCase): | ||
def setUp(self, *args, **kwargs): | ||
super(ShopinvaderControllerCase, self).setUp(*args, **kwargs) | ||
|
@@ -29,7 +23,7 @@ def test_get_addresses_with_correct_api_key_and_partner(self): | |
result = requests.get( | ||
self.url, | ||
headers={ | ||
"API_KEY": self.api_key, | ||
"API_KEY": self.backend.auth_api_key_id.key, | ||
"PARTNER_EMAIL": "[email protected]", | ||
}, | ||
) | ||
|
@@ -44,7 +38,7 @@ def test_get_addresses_with_correct_api_key_and_partner_and_filter(self): | |
result = requests.get( | ||
self.url + "?scope[address_type]=address", | ||
headers={ | ||
"API_KEY": self.api_key, | ||
"API_KEY": self.backend.auth_api_key_id.key, | ||
"PARTNER_EMAIL": "[email protected]", | ||
}, | ||
) | ||
|
@@ -70,7 +64,9 @@ def test_get_addresses_with_wrong_api_key(self): | |
self.assertEqual(result.json(), {u"code": 403, u"name": u"Forbidden"}) | ||
|
||
def test_get_addresses_without_partner(self): | ||
result = requests.get(self.url, headers={"API_KEY": self.api_key}) | ||
result = requests.get( | ||
self.url, headers={"API_KEY": self.backend.auth_api_key_id.key} | ||
) | ||
self.assertEqual(result.status_code, 200) | ||
self.assertEqual(result.json(), {"data": []}) | ||
|
||
|
@@ -83,7 +79,10 @@ def test_email_not_exists(self): | |
""" | ||
# This email shouldn't exist | ||
email = "%[email protected]" % uuid4() | ||
headers = {"API_KEY": self.api_key, "PARTNER_EMAIL": email} | ||
headers = { | ||
"API_KEY": self.backend.auth_api_key_id.key, | ||
"PARTNER_EMAIL": email, | ||
} | ||
expected_msg = "The given partner is not found!" | ||
with self.assertRaises(MissingError) as e: | ||
requests.get(self.url, headers=headers) | ||
|
@@ -100,7 +99,7 @@ def test_email_inactive(self): | |
# This email should exist | ||
self.partner.write({"active": False}) | ||
headers = { | ||
"API_KEY": self.api_key, | ||
"API_KEY": self.backend.auth_api_key_id.key, | ||
"PARTNER_EMAIL": self.partner.email, | ||
} | ||
expected_msg = "The given partner is not found!" | ||
|
@@ -117,6 +116,6 @@ def test_email_not_provided(self): | |
:return: | ||
""" | ||
# Do not provide PARTNER_EMAIL key | ||
headers = {"API_KEY": self.api_key} | ||
headers = {"API_KEY": self.backend.auth_api_key_id.key} | ||
requests.get(self.url, headers=headers) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters