Coverage for tests/endpoints/endpoint_testing.py: 100%
22 statements
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-05 22:06 +0000
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-05 22:06 +0000
1from unittest import TestCase
2from unittest.mock import patch
4from webapp.app import create_app
5from webapp.authentication import get_publishergw_authorization_header
8class TestEndpoints(TestCase):
9 def _log_in(self, client):
10 test_macaroon = "test_macaroon"
11 with client.session_transaction() as s:
12 s["publisher"] = {
13 "account_id": "test_account_id",
14 "image": None,
15 "nickname": "XYZ",
16 "fullname": "ABC XYZ",
17 "email": "testing@testing.com",
18 "stores": [],
19 }
20 s["macaroons"] = "test_macaroon"
21 s["developer_token"] = test_macaroon
22 s["exchanged_developer_token"] = True
24 return get_publishergw_authorization_header(test_macaroon)
26 def setUp(self):
27 self.app = create_app(testing=True)
28 self.client = self.app.test_client()
29 self._log_in(self.client)
32class TestModelServiceEndpoints(TestEndpoints):
33 def setUp(self):
34 self.api_key = "qwertyuioplkjhgfdsazxcvbnmkiopuytrewqasdfghjklmnbv"
35 self.mock_get_store = patch(
36 "webapp.endpoints.views.dashboard.get_store"
37 ).start()
38 super().setUp()