Coverage for tests / endpoints / endpoint_testing.py: 100%
23 statements
« prev ^ index » next coverage.py v7.13.1, created at 2025-12-29 22:06 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2025-12-29 22:06 +0000
1from unittest.mock import patch
3from unittest import TestCase
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 super().setUp()
28 self.app = create_app(testing=True)
29 self.client = self.app.test_client()
30 self._log_in(self.client)
33class TestModelServiceEndpoints(TestEndpoints):
34 def setUp(self):
35 self.api_key = "qwertyuioplkjhgfdsazxcvbnmkiopuytrewqasdfghjklmnbv"
36 self.mock_get_store = patch(
37 "webapp.endpoints.views.dashboard.get_store"
38 ).start()
39 super().setUp()