forked from webflow/webflow-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_scripts.py
More file actions
157 lines (147 loc) · 5.67 KB
/
Copy pathtest_scripts.py
File metadata and controls
157 lines (147 loc) · 5.67 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# This file was auto-generated by Fern from our API Definition.
from webflow import Webflow
from webflow import AsyncWebflow
import typing
from .utilities import validate_response
async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None:
expected_response: typing.Any = {
"registeredScripts": [
{
"id": "alert",
"canCopy": False,
"displayName": "Alert",
"hostedLocation": "https://cdn.webflow.io/.../alert-0.0.1.js",
"integrityHash": "integrityHash",
"createdOn": "2022-10-26T00:28:54.191Z",
"lastUpdated": "lastUpdated",
"version": "0.0.1",
},
{
"id": "alert",
"canCopy": False,
"displayName": "Alert",
"hostedLocation": "https://cdn.webflow.io/.../alert-0.0.2.js",
"integrityHash": "integrityHash",
"createdOn": "2022-10-26T00:28:54.191Z",
"lastUpdated": "lastUpdated",
"version": "0.0.2",
},
{
"id": "cms_slider",
"canCopy": True,
"displayName": "CMS Slider",
"hostedLocation": "https://cdn.jsdelivr.net/.../cms_slider.js",
"integrityHash": "sha384-J+YlJ8v0gpaRoKH7SbFbEmxOZlAxLiwNjfSsBhDooGa5roXlPPpXbEevck4J7YZ+",
"createdOn": "2022-10-26T00:28:54.191Z",
"lastUpdated": "lastUpdated",
"version": "1.0.0",
},
]
}
expected_types: typing.Any = {
"registeredScripts": (
"list",
{
0: {
"id": None,
"canCopy": None,
"displayName": None,
"hostedLocation": None,
"integrityHash": None,
"createdOn": None,
"lastUpdated": None,
"version": None,
},
1: {
"id": None,
"canCopy": None,
"displayName": None,
"hostedLocation": None,
"integrityHash": None,
"createdOn": None,
"lastUpdated": None,
"version": None,
},
2: {
"id": None,
"canCopy": None,
"displayName": None,
"hostedLocation": None,
"integrityHash": None,
"createdOn": None,
"lastUpdated": None,
"version": None,
},
},
)
}
response = client.scripts.list(site_id="580e63e98c9a982ac9b8b741")
validate_response(response, expected_response, expected_types)
async_response = await async_client.scripts.list(site_id="580e63e98c9a982ac9b8b741")
validate_response(async_response, expected_response, expected_types)
async def test_register_hosted(client: Webflow, async_client: AsyncWebflow) -> None:
expected_response: typing.Any = {
"id": "cms_slider",
"canCopy": True,
"displayName": "CMS Slider",
"hostedLocation": "https://cdn.jsdelivr.net/.../cmsslider.js",
"integrityHash": "sha384-J+YlJ8v0gpaRoKH7SbFbEmxOZlAxLiwNjfSsBhDooGa5roXlPPpXbEevck4J7YZ+",
"createdOn": "2022-10-26T00:28:54.191Z",
"lastUpdated": "lastUpdated",
"version": "1.0.0",
}
expected_types: typing.Any = {
"id": None,
"canCopy": None,
"displayName": None,
"hostedLocation": None,
"integrityHash": None,
"createdOn": None,
"lastUpdated": None,
"version": None,
}
response = client.scripts.register_hosted(
site_id="580e63e98c9a982ac9b8b741",
hosted_location="hostedLocation",
integrity_hash="integrityHash",
version="version",
display_name="displayName",
)
validate_response(response, expected_response, expected_types)
async_response = await async_client.scripts.register_hosted(
site_id="580e63e98c9a982ac9b8b741",
hosted_location="hostedLocation",
integrity_hash="integrityHash",
version="version",
display_name="displayName",
)
validate_response(async_response, expected_response, expected_types)
async def test_register_inline(client: Webflow, async_client: AsyncWebflow) -> None:
expected_response: typing.Any = {
"id": "alert",
"canCopy": False,
"displayName": "Alert",
"hostedLocation": "https://uploads-ssl.webflow.com/6258612d1ee792848f805dcf%2F64b6c769ff52ba6c3d904a91%2F660d6e15b3d1696f2d2b1447%2Falert-0.0.1.js",
"integrityHash": "integrityHash",
"createdOn": "2022-10-26T00:28:54.191Z",
"lastUpdated": "lastUpdated",
"version": "0.0.1",
}
expected_types: typing.Any = {
"id": None,
"canCopy": None,
"displayName": None,
"hostedLocation": None,
"integrityHash": None,
"createdOn": None,
"lastUpdated": None,
"version": None,
}
response = client.scripts.register_inline(
site_id="580e63e98c9a982ac9b8b741", source_code="alert('hello world');", version="0.0.1", display_name="Alert"
)
validate_response(response, expected_response, expected_types)
async_response = await async_client.scripts.register_inline(
site_id="580e63e98c9a982ac9b8b741", source_code="alert('hello world');", version="0.0.1", display_name="Alert"
)
validate_response(async_response, expected_response, expected_types)