-
Notifications
You must be signed in to change notification settings - Fork 47
/
fixtures_asset.py
39 lines (27 loc) · 962 Bytes
/
fixtures_asset.py
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
import os
import pytest
from .fixtures_globals import ASSET_ID, JSON_ASSET, DOWNLOAD_URL
from ..context import (
Asset,
)
@pytest.fixture()
def asset_mock(auth_mock, requests_mock):
# asset info
url_asset_info = f"{auth_mock._endpoint()}/v2/assets/{ASSET_ID}/metadata"
requests_mock.get(url=url_asset_info, json=JSON_ASSET)
# asset update
updated_json_asset = JSON_ASSET.copy()
updated_json_asset["title"] = "some_other_title"
updated_json_asset["tags"] = ["othertag1", "othertag2"]
requests_mock.post(url=url_asset_info, json=updated_json_asset)
# download url
requests_mock.post(
url=f"{auth_mock._endpoint()}/v2/assets/{ASSET_ID}/download-url",
json={"url": DOWNLOAD_URL},
)
asset = Asset(auth=auth_mock, asset_id=ASSET_ID)
return asset
@pytest.fixture()
def asset_live(auth_live):
asset = Asset(auth=auth_live, asset_id=os.getenv("TEST_UP42_ASSET_ID"))
return asset