-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_access.py
More file actions
42 lines (31 loc) · 1.05 KB
/
Copy pathtest_access.py
File metadata and controls
42 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pytest
from mpt_api_client import (
BearerTokenAuthentication,
ExtensionFrameworkAuthentication,
MPTClient,
)
from mpt_api_client.exceptions import MPTHttpError
@pytest.mark.flaky
def test_unauthorised(base_url):
client = MPTClient.from_config(
authentication=BearerTokenAuthentication("TKN-invalid"),
base_url=base_url,
)
with pytest.raises(MPTHttpError, match=r"401 Authentication Failed"):
client.catalog.products.fetch_page()
@pytest.mark.flaky
def test_access(mpt_vendor, product_id):
result = mpt_vendor.catalog.products.get(product_id)
assert result.id == product_id
@pytest.mark.flaky
def test_extension_framework_access(
extension_secret, installation_account_id, base_url, product_id
):
client = MPTClient.from_config(
authentication=ExtensionFrameworkAuthentication(
secret=extension_secret, account_id=installation_account_id
),
base_url=base_url,
)
result = client.catalog.products.get(product_id)
assert result.id == product_id