smartsheet-python-sdk 3.5.0__py2.py3-none-any.whl → 3.5.2__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smartsheet/models/__init__.py +1 -0
- smartsheet/models/asset_shares_paginated_result.py +84 -0
- smartsheet/{asset_shares.py → sharing.py} +3 -3
- smartsheet/smartsheet.py +17 -0
- smartsheet/version.py +2 -2
- {smartsheet_python_sdk-3.5.0.dist-info → smartsheet_python_sdk-3.5.2.dist-info}/METADATA +1 -1
- {smartsheet_python_sdk-3.5.0.dist-info → smartsheet_python_sdk-3.5.2.dist-info}/RECORD +59 -10
- {smartsheet_python_sdk-3.5.0.dist-info → smartsheet_python_sdk-3.5.2.dist-info}/top_level.txt +1 -0
- tests/__init__.py +0 -0
- tests/integration/README.md +37 -0
- tests/integration/conftest.py +174 -0
- tests/integration/fixtures/calling_all_curs.txt +1 -0
- tests/integration/fixtures/curly.jpg +0 -0
- tests/integration/fixtures/moe-curly.jpg +0 -0
- tests/integration/fixtures/quote.txt +1 -0
- tests/integration/fixtures/stooges_v1.jpg +0 -0
- tests/integration/fixtures/stooges_v2.jpg +0 -0
- tests/integration/test_attachments.py +99 -0
- tests/integration/test_columns.py +91 -0
- tests/integration/test_contacts.py +27 -0
- tests/integration/test_cross_sheet_references.py +30 -0
- tests/integration/test_discussions.py +195 -0
- tests/integration/test_events.py +56 -0
- tests/integration/test_favorites.py +33 -0
- tests/integration/test_folders.py +130 -0
- tests/integration/test_groups.py +92 -0
- tests/integration/test_home.py +99 -0
- tests/integration/test_model_attributes.py +2848 -0
- tests/integration/test_multi_picklist.py +66 -0
- tests/integration/test_object_value.py +126 -0
- tests/integration/test_passthrough.py +37 -0
- tests/integration/test_regression.py +240 -0
- tests/integration/test_reports.py +134 -0
- tests/integration/test_rows.py +196 -0
- tests/integration/test_server_info.py +10 -0
- tests/integration/test_sharing.py +83 -0
- tests/integration/test_sheet_summary.py +64 -0
- tests/integration/test_sheets.py +384 -0
- tests/integration/test_templates.py +21 -0
- tests/integration/test_update_requests.py +61 -0
- tests/integration/test_users.py +134 -0
- tests/integration/test_webhooks.py +50 -0
- tests/integration/test_workspaces.py +271 -0
- tests/integration/test_zsearch.py +30 -0
- tests/mock_api/__init__.py +0 -0
- tests/mock_api/mock_api_test_helper.py +73 -0
- tests/mock_api/test_mock_api_automation_rules.py +39 -0
- tests/mock_api/test_mock_api_columns.py +48 -0
- tests/mock_api/test_mock_api_folders.py +184 -0
- tests/mock_api/test_mock_api_rows.py +715 -0
- tests/mock_api/test_mock_api_sharing.py +508 -0
- tests/mock_api/test_mock_api_sheets.py +42 -0
- tests/mock_api/test_mock_api_sights.py +58 -0
- tests/mock_api/test_mock_api_workspaces.py +241 -0
- tests/mock_api/test_mock_change_agent.py +26 -0
- tests/mock_api/test_mock_serialization.py +559 -0
- {smartsheet_python_sdk-3.5.0.dist-info → smartsheet_python_sdk-3.5.2.dist-info}/LICENSE.md +0 -0
- {smartsheet_python_sdk-3.5.0.dist-info → smartsheet_python_sdk-3.5.2.dist-info}/NOTICE +0 -0
- {smartsheet_python_sdk-3.5.0.dist-info → smartsheet_python_sdk-3.5.2.dist-info}/WHEEL +0 -0
smartsheet/models/__init__.py
CHANGED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
|
|
2
|
+
# Smartsheet Python SDK.
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2018 Smartsheet.com, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"): you may
|
|
7
|
+
# not use this file except in compliance with the License. You may obtain
|
|
8
|
+
# a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
14
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
15
|
+
# License for the specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
|
|
18
|
+
from __future__ import absolute_import
|
|
19
|
+
|
|
20
|
+
from typing import TypeVar, List
|
|
21
|
+
from ..types import String, json, TypedList, importlib
|
|
22
|
+
from ..util import deserialize, serialize
|
|
23
|
+
from . import Share
|
|
24
|
+
|
|
25
|
+
T = TypeVar('T')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class AssetSharesPaginatedResult:
|
|
29
|
+
"""Smartsheet AssetSharesPaginatedResult data model with generic type support.
|
|
30
|
+
Use only for deserializing the response from GET /2.0/shares.
|
|
31
|
+
Created because GET /2.0/shares returns items in the response body instead of data.
|
|
32
|
+
As a result TokenPaginatedResult cannot be used.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def __init__(self, props=None, dynamic_data_type=None, base_obj=None):
|
|
36
|
+
"""Initialize the TokenPaginatedResult model."""
|
|
37
|
+
self._base = None
|
|
38
|
+
if base_obj is not None:
|
|
39
|
+
self._base = base_obj
|
|
40
|
+
|
|
41
|
+
self._dynamic_data_type = None
|
|
42
|
+
if dynamic_data_type is not None:
|
|
43
|
+
self._dynamic_data_type = dynamic_data_type
|
|
44
|
+
|
|
45
|
+
self._items = TypedList(object)
|
|
46
|
+
self._last_key = String()
|
|
47
|
+
|
|
48
|
+
if props:
|
|
49
|
+
deserialize(self, props)
|
|
50
|
+
|
|
51
|
+
self.request_response = None
|
|
52
|
+
self.__initialized = True
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def items(self) -> List[Share]:
|
|
56
|
+
return self._items
|
|
57
|
+
|
|
58
|
+
@items.setter
|
|
59
|
+
def items(self, value):
|
|
60
|
+
class_ = getattr(
|
|
61
|
+
importlib.import_module("smartsheet.models"), self._dynamic_data_type
|
|
62
|
+
)
|
|
63
|
+
if isinstance(value, list):
|
|
64
|
+
self._items = [class_(x, self._base) for x in value]
|
|
65
|
+
else:
|
|
66
|
+
self._items = class_(value, self._base)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def last_key(self):
|
|
71
|
+
return self._last_key.value
|
|
72
|
+
|
|
73
|
+
@last_key.setter
|
|
74
|
+
def last_key(self, value):
|
|
75
|
+
self._last_key.value = value
|
|
76
|
+
|
|
77
|
+
def to_dict(self):
|
|
78
|
+
return serialize(self)
|
|
79
|
+
|
|
80
|
+
def to_json(self):
|
|
81
|
+
return json.dumps(self.to_dict())
|
|
82
|
+
|
|
83
|
+
def __str__(self):
|
|
84
|
+
return self.to_json()
|
|
@@ -43,7 +43,7 @@ class Sharing:
|
|
|
43
43
|
sharing_include (ShareScope): Scope of share to include in response
|
|
44
44
|
|
|
45
45
|
Returns:
|
|
46
|
-
|
|
46
|
+
AssetSharesPaginatedResult
|
|
47
47
|
"""
|
|
48
48
|
_op = fresh_operation('list_asset_shares')
|
|
49
49
|
_op['method'] = 'GET'
|
|
@@ -54,7 +54,7 @@ class Sharing:
|
|
|
54
54
|
_op['query_params']['lastKey'] = last_key
|
|
55
55
|
_op['query_params']['sharingInclude'] = sharing_include.name if sharing_include else None
|
|
56
56
|
|
|
57
|
-
expected = ['
|
|
57
|
+
expected = ['AssetSharesPaginatedResult', 'Share']
|
|
58
58
|
|
|
59
59
|
prepped_request = self._base.prepare_request(_op)
|
|
60
60
|
response = self._base.request(prepped_request, expected, _op)
|
|
@@ -132,7 +132,7 @@ class Sharing:
|
|
|
132
132
|
_op['query_params']['assetId'] = asset_id
|
|
133
133
|
_op['json'] = share_obj
|
|
134
134
|
|
|
135
|
-
expected =
|
|
135
|
+
expected = 'Share'
|
|
136
136
|
|
|
137
137
|
prepped_request = self._base.prepare_request(_op)
|
|
138
138
|
response = self._base.request(prepped_request, expected, _op)
|
smartsheet/smartsheet.py
CHANGED
|
@@ -185,6 +185,8 @@ class Smartsheet:
|
|
|
185
185
|
self._api_base = api_base
|
|
186
186
|
self._assume_user = None
|
|
187
187
|
self._test_scenario_name = None
|
|
188
|
+
self._wiremock_test_name = None
|
|
189
|
+
self._wiremock_request_id = None
|
|
188
190
|
self._change_agent = None
|
|
189
191
|
|
|
190
192
|
def assume_user(self, email=None):
|
|
@@ -227,6 +229,18 @@ class Smartsheet:
|
|
|
227
229
|
"""
|
|
228
230
|
self._test_scenario_name = name
|
|
229
231
|
|
|
232
|
+
def with_wiremock_test_case(self, test_name: str, request_id: str):
|
|
233
|
+
"""
|
|
234
|
+
Configure client with x-test-name and x-request-id headers.
|
|
235
|
+
Used for wiremock test cases.
|
|
236
|
+
|
|
237
|
+
Args:
|
|
238
|
+
test_name (str): The name of the wiremock test case.
|
|
239
|
+
request_id (str): The unique request ID for this test scenario.
|
|
240
|
+
"""
|
|
241
|
+
self._wiremock_test_name = test_name
|
|
242
|
+
self._wiremock_request_id = request_id
|
|
243
|
+
|
|
230
244
|
def with_change_agent(self, change_agent):
|
|
231
245
|
"""
|
|
232
246
|
Request headers will contain the 'Smartsheet-Change-Agent' header value
|
|
@@ -437,6 +451,9 @@ class Smartsheet:
|
|
|
437
451
|
del prepped_request.headers["Api-Scenario"]
|
|
438
452
|
except KeyError:
|
|
439
453
|
pass
|
|
454
|
+
if self._wiremock_test_name is not None and self._wiremock_request_id is not None:
|
|
455
|
+
prepped_request.headers["X-Test-Name"] = self._wiremock_test_name
|
|
456
|
+
prepped_request.headers["X-Request-ID"] = self._wiremock_request_id
|
|
440
457
|
|
|
441
458
|
if self._change_agent is not None:
|
|
442
459
|
prepped_request.headers.update(
|
smartsheet/version.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
smartsheet/__init__.py,sha256=h2TD_nYTxqa7lcKb_mOIa-DMQN-pYaGk1Du0U3IVMyA,1152
|
|
2
|
-
smartsheet/asset_shares.py,sha256=ztkh5uQOLKHT2AkjRnm_3yDRbFFUzNdBSCZbL5FhLVA,5839
|
|
3
2
|
smartsheet/attachments.py,sha256=eZ1y5jS_TJSyZzzapc68ol1qhrLxCXc2sY8l8oY1Gvo,17865
|
|
4
3
|
smartsheet/cells.py,sha256=1BCBps0mV9FV_nmdtsP5j7jT0avTVIfbYSAhnOqzlwM,4845
|
|
5
4
|
smartsheet/contacts.py,sha256=IBV3ncoP7R7GmzQI0H1CIwq4scGk9iBC1ayyQ927YrQ,2383
|
|
@@ -17,21 +16,23 @@ smartsheet/reports.py,sha256=0B5bdQwVJHwu-V04aMSJ-Y7HaILK4rgjjMtn0--kcig,12835
|
|
|
17
16
|
smartsheet/search.py,sha256=ffy1dkVl3GtuYgCxvuR-vwahOBWIehGv_zwzLoJMimA,3394
|
|
18
17
|
smartsheet/server.py,sha256=9wySsa_y_G-VO88tEHGHp919zRVFS0kCFIhiM6crWEU,1429
|
|
19
18
|
smartsheet/session.py,sha256=TQ3IgVZ64r7Dszwo8rMISFezWxuwFYshhW9QhzoA428,2125
|
|
19
|
+
smartsheet/sharing.py,sha256=vonbDFD5nXrhcRTjTdBmZVZs4TB1BWVk2eOJslydmUE,5857
|
|
20
20
|
smartsheet/sheets.py,sha256=2SUhanCsRFKCsbN-oAIRMsuYnk1aSFlXKzfZhxMo7d0,70603
|
|
21
21
|
smartsheet/sights.py,sha256=IZgy8CJZBJ-pQo6vNwkDSBuoLCv5RAW39kNUMMNJ-oc,11569
|
|
22
|
-
smartsheet/smartsheet.py,sha256=
|
|
22
|
+
smartsheet/smartsheet.py,sha256=bx5uAH6sH5SXBui2XILuNsFo06lnc8Z8_eo1Uzzd6as,24454
|
|
23
23
|
smartsheet/templates.py,sha256=z_Tj-4jZsu3RkLNbCAZWM2W05Zbio9T_uyU33rUPxzE,2898
|
|
24
24
|
smartsheet/token.py,sha256=5uz-IG5adx_zr2-uepH-W8ATv0dq9aZNjYLeZNwldqI,4703
|
|
25
25
|
smartsheet/types.py,sha256=aIdRJ89jwclmiZ4RH3hnZHJTFWFxgNKW3d8fghm21eM,9126
|
|
26
26
|
smartsheet/users.py,sha256=1KnqKJIzJEPMNy26BQY1b9jb3dItbzglrljV1MGD5ic,15887
|
|
27
27
|
smartsheet/util.py,sha256=12Y6eluecB8k4Ns-at81AEM18ND2TCKa9bF4BlNRrKM,5633
|
|
28
|
-
smartsheet/version.py,sha256=
|
|
28
|
+
smartsheet/version.py,sha256=OQ0f_DFwVp2oC6nqaYeOMvAmplmRtX58iNhel24HEag,160
|
|
29
29
|
smartsheet/webhooks.py,sha256=7F7g4Ks0GyS3QxsNWm1SFtrOr00jBisCjj7-hcToHM8,4637
|
|
30
30
|
smartsheet/workspaces.py,sha256=r81xh3HfYsX--ll5pQ-h7kSSJELokYV-bSjuD0WloeU,22651
|
|
31
|
-
smartsheet/models/__init__.py,sha256=
|
|
31
|
+
smartsheet/models/__init__.py,sha256=lH951xll0kO3GA6CrgW4UgMOcXu2x7BjvZBFQfpgqKY,4824
|
|
32
32
|
smartsheet/models/access_token.py,sha256=sKHL5cFRWPTjymX06ZIXaCDp8ZJQEVpXN8mns1DAvGM,2564
|
|
33
33
|
smartsheet/models/account.py,sha256=nLg_5O4Vnc7aNf9p1kIcsgdAm23IC2H7cKkxjLxwS9U,1941
|
|
34
34
|
smartsheet/models/alternate_email.py,sha256=n8zqWkY-uzSw_CVKBvYUc6pGSR0v4yTx8S5PaIiX_AU,2263
|
|
35
|
+
smartsheet/models/asset_shares_paginated_result.py,sha256=kSee44-T_7hn-hz7kgKAVAa6vFs06IhFQ7AIpohe7WE,2531
|
|
35
36
|
smartsheet/models/attachment.py,sha256=5DgnZ4fj19rtIgN3INqlP0zYh8JNa0DRleeAS52tQ2o,4684
|
|
36
37
|
smartsheet/models/auto_number_format.py,sha256=LRNIkasbspWKJFg0hwMvhSe4HmuuNRrvH_jerCbKooM,2091
|
|
37
38
|
smartsheet/models/automation_action.py,sha256=_1cb_ubhR4Xx56UNGi3dLXdfoBkA7oyjDWu2wA98p-Q,4526
|
|
@@ -185,9 +186,57 @@ smartsheet/models/enums/system_column_type.py,sha256=UfhNUBGD_0K1Pas7fujGEuax55O
|
|
|
185
186
|
smartsheet/models/enums/update_request_status.py,sha256=xYF84x1dTFhJMYVi1q3G1T9u1IGN3szlR1jj5HHC0hE,777
|
|
186
187
|
smartsheet/models/enums/user_status.py,sha256=SB7qRcA0dhdRimsOKHCGF3CB6fL0XuifxQEWZGNNS8Q,766
|
|
187
188
|
smartsheet/models/enums/widget_type.py,sha256=VfVq59fLZsT4ks_ZBrtv52u2Cl60iAdlA6mGD_elz-k,1072
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
190
|
+
tests/integration/README.md,sha256=URfm5x5IdE---oMkO3vMePPJ8ZdESJTvPzMdjzv6TnY,1352
|
|
191
|
+
tests/integration/conftest.py,sha256=8YxuffY8hOZ1NtU7mw95-H6i5wcChxJIketxIO6OrD0,5275
|
|
192
|
+
tests/integration/test_attachments.py,sha256=3MxrAa05CRCgPqNu2W5m0Arum1oJAdEO7LhBwhF0q80,3631
|
|
193
|
+
tests/integration/test_columns.py,sha256=noHTyMKjq8vMIgkh033YQEkXiY52nxAmp-Mto36Jv4E,2951
|
|
194
|
+
tests/integration/test_contacts.py,sha256=uN3qSeuhId0x5MinvsKXgRyPaDHL1NLH7CccXWtZ4FY,910
|
|
195
|
+
tests/integration/test_cross_sheet_references.py,sha256=RqiTayGNlIXLqNT3OQbk3zcCcX4HlLnKwTJbSDNb_OE,1330
|
|
196
|
+
tests/integration/test_discussions.py,sha256=9ltns9SN73be0WVGi38PCLzwKLX5qxmbHP7mmDgBiEg,7370
|
|
197
|
+
tests/integration/test_events.py,sha256=pMMoywNP1xDiGkCJm0ImM2p2jYN0buB6PLP4R4xP_7c,2582
|
|
198
|
+
tests/integration/test_favorites.py,sha256=NhoqXhcZu2vNkXex3ZaSXSPOdMPx-AyMztu3_6NUjcM,1130
|
|
199
|
+
tests/integration/test_folders.py,sha256=2ZoMCerrIkx9IGd7izhDORDy2RjeGyGenFkGZrLzZlY,5200
|
|
200
|
+
tests/integration/test_groups.py,sha256=vWwreXgiuxlOolD0MgNKHn2ANTH3avuLH7U6xZlkvUQ,2846
|
|
201
|
+
tests/integration/test_home.py,sha256=a95auUi1rggg2oS6dXxyL5GgEr0VvYfv9RrmM0NbDpk,3449
|
|
202
|
+
tests/integration/test_model_attributes.py,sha256=vcF89w8E6x3Ir5WnUqNwyM6Zp2wDFfkEm1ZOkHdnxlE,100219
|
|
203
|
+
tests/integration/test_multi_picklist.py,sha256=xHlbxtpmk_vTwisJ57M6U3bMeQtnea2KVC5YwO48SXs,2537
|
|
204
|
+
tests/integration/test_object_value.py,sha256=mCmFwGoN0t3D8wXiZ63dzlPDPciWtSUDNVUYhpBFEBc,4224
|
|
205
|
+
tests/integration/test_passthrough.py,sha256=vRg9OTBb-y7u5p25fjYnQSKGbSZcanSzReesaVqwYEc,1603
|
|
206
|
+
tests/integration/test_regression.py,sha256=KOMP6vqAVFrN_UCAKD90V3s0eGpWSsUxxphHRFBOAFs,8208
|
|
207
|
+
tests/integration/test_reports.py,sha256=37iTenbbnCP0p2I9UzbQoWwjF4eFFGrBRlSnop0N1FQ,4712
|
|
208
|
+
tests/integration/test_rows.py,sha256=MNzLZOHSBZGWslC8peuD9p_dQ9Jj_V3QHN6C16u4BJY,7596
|
|
209
|
+
tests/integration/test_server_info.py,sha256=atoRjGEFwbja51wyui_5-CeiK27-xLTvQXl4-nUA810,268
|
|
210
|
+
tests/integration/test_sharing.py,sha256=XuMCybgDyZaudEiomOV-XbP-kLY8lY4xfp7Uc-gYREY,2694
|
|
211
|
+
tests/integration/test_sheet_summary.py,sha256=siRtHTZVLaCV3dDrcpApXHLSWmnpncQdMm7OTlk_f6s,3357
|
|
212
|
+
tests/integration/test_sheets.py,sha256=hL5C_hs8y2FyoGBaKcQDsll2RCQeqdFQoGGcDc9BFyQ,14531
|
|
213
|
+
tests/integration/test_templates.py,sha256=vbgxkPkO0DzZ4AfA5wecUKYLQ7Dm_Qux7HB7TxQmWvQ,799
|
|
214
|
+
tests/integration/test_update_requests.py,sha256=Qx-jRLCbTnoJG48J98OzB7g8f8IRmNISiqQNwsArZo4,2726
|
|
215
|
+
tests/integration/test_users.py,sha256=SLWU0D-QfCAp3ymgBoySq_8svet5L31H7WCH9eBaQ5w,4609
|
|
216
|
+
tests/integration/test_webhooks.py,sha256=5pDyfv3BREscXHk7AUOrLDlvsQIZHvPcW6dvZfVI2Hg,1901
|
|
217
|
+
tests/integration/test_workspaces.py,sha256=Xn7mAi0dOIPHZE7Qnff1K16X1FYTc7CbdYims8NIEus,11202
|
|
218
|
+
tests/integration/test_zsearch.py,sha256=fUCCYO25dfX_aby6VVJVpGWsI_-9c-dO__cnRmcPAfI,1101
|
|
219
|
+
tests/integration/fixtures/calling_all_curs.txt,sha256=w6y8iLcnN7Cr2qzTW85n-Y0piB7TWNCJBzYBeC85gNM,61
|
|
220
|
+
tests/integration/fixtures/curly.jpg,sha256=EAgX6jplNdLuy12xTPR_IUO8aBd4FH0wBojP_j8qnKo,17988
|
|
221
|
+
tests/integration/fixtures/moe-curly.jpg,sha256=GeM6RLaXEaAU92RC7pP6kCoO84VPS72qB3Al2reZ9-4,65440
|
|
222
|
+
tests/integration/fixtures/quote.txt,sha256=mC4gL6QbbtpBUXDJHUV7JJNbe0lZRDehuhi05ejYBKk,20
|
|
223
|
+
tests/integration/fixtures/stooges_v1.jpg,sha256=6_FT9q2QK9yxymbhS5c_e8gx6PQnwXj2Z83X47ZP9hc,90832
|
|
224
|
+
tests/integration/fixtures/stooges_v2.jpg,sha256=MSUu7Uh2rTjlnjXgvQFn4s8hErUD5AqbyO0AzMfntJg,30550
|
|
225
|
+
tests/mock_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
226
|
+
tests/mock_api/mock_api_test_helper.py,sha256=6Kmp0yrA68gOTItiHEhHYhqh3LpGnqV_5O3DNgw2tdY,2191
|
|
227
|
+
tests/mock_api/test_mock_api_automation_rules.py,sha256=tEsSkFRF9frJciXD7y_A3T1QF5NFLb6HUC_34Q4gcDc,1609
|
|
228
|
+
tests/mock_api/test_mock_api_columns.py,sha256=9-jvgluH5hWyNEKgfPIB5nPtW40KjD6Q7GUr-EzcMis,1490
|
|
229
|
+
tests/mock_api/test_mock_api_folders.py,sha256=MUDeVv0rn5vAs6GDtrKfIaap-jBO-syoy5MBb2vYJ0E,6755
|
|
230
|
+
tests/mock_api/test_mock_api_rows.py,sha256=2xNqQsvqnk4T_dsWrmu1BPVhNvTlb_gffClaz_LIbpg,20972
|
|
231
|
+
tests/mock_api/test_mock_api_sharing.py,sha256=6psgcUXvc2nCq3OS1M9-pQ0YJZmhVDs2pCYAmvgzF_U,15085
|
|
232
|
+
tests/mock_api/test_mock_api_sheets.py,sha256=61mhb0iUnR8j4_5XTrfI9aQHOGGX3RTc3tGsn8G0V2k,1225
|
|
233
|
+
tests/mock_api/test_mock_api_sights.py,sha256=UazPkjGu2UnT_dRz189v1DMhMBDeTRKtWxux6aYao2k,2203
|
|
234
|
+
tests/mock_api/test_mock_api_workspaces.py,sha256=8QzRrkRoenCCD5tB5crmpGzXNmSP9kLjEUU046DJ1AE,9419
|
|
235
|
+
tests/mock_api/test_mock_change_agent.py,sha256=WDd6MKERhqGQJ3QrTQK5ylXMhZ65o5vnhscBlisFjoM,757
|
|
236
|
+
tests/mock_api/test_mock_serialization.py,sha256=0veKtirhYve8BZL8M3yPuREpw-a8TzYK7tH7aLD7LqQ,18174
|
|
237
|
+
smartsheet_python_sdk-3.5.2.dist-info/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
238
|
+
smartsheet_python_sdk-3.5.2.dist-info/METADATA,sha256=tbNMz9R8y4hJo70xPGAQv2bWvOtLz_WojhK0Wv_A-hs,4734
|
|
239
|
+
smartsheet_python_sdk-3.5.2.dist-info/NOTICE,sha256=mXr2ryVjnCjykeW0J79kFfVXQG_Z9SV4BV_QPNENW1U,420
|
|
240
|
+
smartsheet_python_sdk-3.5.2.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
|
|
241
|
+
smartsheet_python_sdk-3.5.2.dist-info/top_level.txt,sha256=ACM1Ryc7rQRwrJIuN7H4aEMO-wUGjiYQshvRPoiOYT4,17
|
|
242
|
+
smartsheet_python_sdk-3.5.2.dist-info/RECORD,,
|
tests/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# smartsheet-python-sdk unit tests
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
From the root directory of this repository:
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
python setup.py develop
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Running the tests
|
|
12
|
+
|
|
13
|
+
Again, from the root directory of this repository:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
python setup.py test
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
Some tests carry requirements. We're testing the real service here, not just using mocks. In order to do that, some configuration is necessary for some tests.
|
|
22
|
+
|
|
23
|
+
The test suite expects these environment variables to be present:
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
export SMARTSHEET_ACCESS_TOKEN="SSSSSSSSSSSSSSSSSSSSSSSSSS"
|
|
27
|
+
export LOG_CFG="debug" # optional
|
|
28
|
+
export SMARTSHEET_FIXTURE_USERS='{"admin":{"id":9999999999999999},"larry":{"id":0000000000000000},"curly":{"id":1111111111111111},"moe":{"id":2222222222222222}}'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Please note:** the user nicknames (admin, larry, curly, moe) are not essential. However, valid IDs of users within the Smartsheet organization the access token belongs to are required.
|
|
32
|
+
|
|
33
|
+
In addition, reports tests will be skipped unless there is a report within the organization. The report will not be modified or deleted, but must exist in order to acceptance-test the API methods pertaining to Reports.
|
|
34
|
+
|
|
35
|
+
The `admin` user needs at least one Contact.
|
|
36
|
+
|
|
37
|
+
Finally, the user corresponding to `moe` needs to be a Licensed User. `larry` and `curly` do not need to be Licensed Users.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import smartsheet
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from dateutil.tz import *
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import six
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture(scope="module")
|
|
11
|
+
def smart_setup(request):
|
|
12
|
+
# set up a test session folder with basic starting points
|
|
13
|
+
smart = smartsheet.Smartsheet(max_retry_time=60)
|
|
14
|
+
now = datetime.now(tzlocal()).strftime("%Y-%m-%d %H:%M:%S")
|
|
15
|
+
|
|
16
|
+
users = os.environ.get('SMARTSHEET_FIXTURE_USERS', None)
|
|
17
|
+
if users is None:
|
|
18
|
+
pytest.exit('Environment not setup correctly...aborting')
|
|
19
|
+
|
|
20
|
+
users = json.loads(users)
|
|
21
|
+
fixusers = {}
|
|
22
|
+
for nick,info in six.iteritems(users):
|
|
23
|
+
profile = smart.Users.get_user(info['id'])
|
|
24
|
+
assert isinstance(profile, smart.models.UserProfile)
|
|
25
|
+
fixusers[nick] = profile
|
|
26
|
+
action = smart.Groups.list_groups(include_all=True)
|
|
27
|
+
assert isinstance(action, smart.models.IndexResult)
|
|
28
|
+
grps = action.result
|
|
29
|
+
groups = {}
|
|
30
|
+
need_exec = True
|
|
31
|
+
for gp in grps:
|
|
32
|
+
groups[gp.name] = gp
|
|
33
|
+
if gp.name == 'exec':
|
|
34
|
+
need_exec = False
|
|
35
|
+
|
|
36
|
+
if need_exec:
|
|
37
|
+
group = smart.models.Group({
|
|
38
|
+
'name': 'exec',
|
|
39
|
+
'members': [
|
|
40
|
+
smart.models.GroupMember({
|
|
41
|
+
'email': fixusers['moe'].email
|
|
42
|
+
}),
|
|
43
|
+
smart.models.GroupMember({
|
|
44
|
+
'email': fixusers['admin'].email
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
})
|
|
48
|
+
action = smart.Groups.create_group(group)
|
|
49
|
+
assert action.message == 'SUCCESS'
|
|
50
|
+
|
|
51
|
+
# test run base folders
|
|
52
|
+
folder_name = 'pytest ' + now
|
|
53
|
+
action = smart.Home.create_folder(folder_name)
|
|
54
|
+
assert action.message == 'SUCCESS'
|
|
55
|
+
test_folder = action.result
|
|
56
|
+
|
|
57
|
+
# add a sheet to mess around with
|
|
58
|
+
sheet = smart.models.Sheet({
|
|
59
|
+
'name': 'pytest_fixture_sheet ' + now,
|
|
60
|
+
'columns': [{
|
|
61
|
+
'title': 'The First Column',
|
|
62
|
+
'primary': True,
|
|
63
|
+
'type': 'TEXT_NUMBER'
|
|
64
|
+
}, {
|
|
65
|
+
'title': 'Favorite',
|
|
66
|
+
'type': 'CHECKBOX',
|
|
67
|
+
'symbol': 'STAR'
|
|
68
|
+
}, {
|
|
69
|
+
'title': 'Disposable',
|
|
70
|
+
'type': 'TEXT_NUMBER'
|
|
71
|
+
}]
|
|
72
|
+
})
|
|
73
|
+
action = smart.Folders.create_sheet_in_folder(test_folder.id, sheet)
|
|
74
|
+
assert action.message == 'SUCCESS'
|
|
75
|
+
sheet = action.result
|
|
76
|
+
|
|
77
|
+
# get primary column id
|
|
78
|
+
for idx, col in enumerate(sheet.columns):
|
|
79
|
+
if col.primary:
|
|
80
|
+
break
|
|
81
|
+
sheet_primary_col = col
|
|
82
|
+
|
|
83
|
+
# add a row
|
|
84
|
+
action = sheet.add_rows([smart.models.Row({
|
|
85
|
+
'to_top': True,
|
|
86
|
+
'cells': [{
|
|
87
|
+
'column_id': sheet_primary_col.id,
|
|
88
|
+
'value': 'The first column of the first row.'
|
|
89
|
+
}]
|
|
90
|
+
})])
|
|
91
|
+
assert action.message == 'SUCCESS'
|
|
92
|
+
|
|
93
|
+
sheet = smart.Sheets.get_sheet(sheet.id)
|
|
94
|
+
assert isinstance(sheet, smart.models.Sheet)
|
|
95
|
+
|
|
96
|
+
sheet_b = smart.models.Sheet({
|
|
97
|
+
'name': 'pytest_fixture_sheetB ' + now,
|
|
98
|
+
'columns': [{
|
|
99
|
+
'title': 'Brand',
|
|
100
|
+
'primary': True,
|
|
101
|
+
'type': 'TEXT_NUMBER'
|
|
102
|
+
}]
|
|
103
|
+
})
|
|
104
|
+
action = smart.Folders.create_sheet_in_folder(test_folder.id, sheet_b)
|
|
105
|
+
assert action.message == 'SUCCESS'
|
|
106
|
+
sheet_b = action.result
|
|
107
|
+
for idx, col in enumerate(sheet_b.columns):
|
|
108
|
+
if col.primary:
|
|
109
|
+
break
|
|
110
|
+
sheet_b_primary_col = col
|
|
111
|
+
|
|
112
|
+
action = sheet_b.add_rows([
|
|
113
|
+
smart.models.Row({
|
|
114
|
+
'to_top': True,
|
|
115
|
+
'cells': [{
|
|
116
|
+
'column_id': sheet_b_primary_col.id,
|
|
117
|
+
'value': 'Nike'
|
|
118
|
+
}]
|
|
119
|
+
}),
|
|
120
|
+
smart.models.Row({
|
|
121
|
+
'to_top': True,
|
|
122
|
+
'cells': [{
|
|
123
|
+
'column_id': sheet_b_primary_col.id,
|
|
124
|
+
'value': 'Google'
|
|
125
|
+
}]
|
|
126
|
+
}),
|
|
127
|
+
smart.models.Row({
|
|
128
|
+
'to_top': True,
|
|
129
|
+
'cells': [{
|
|
130
|
+
'column_id': sheet_b_primary_col.id,
|
|
131
|
+
'value': 'Adidas'
|
|
132
|
+
}]
|
|
133
|
+
}),
|
|
134
|
+
smart.models.Row({
|
|
135
|
+
'to_top': True,
|
|
136
|
+
'cells': [{
|
|
137
|
+
'column_id': sheet_b_primary_col.id,
|
|
138
|
+
'value': 'Keen'
|
|
139
|
+
}]
|
|
140
|
+
})])
|
|
141
|
+
assert action.message == 'SUCCESS'
|
|
142
|
+
|
|
143
|
+
sheet_b = smart.Sheets.get_sheet(sheet_b.id)
|
|
144
|
+
assert isinstance(sheet_b, smart.models.Sheet)
|
|
145
|
+
|
|
146
|
+
fixture = {
|
|
147
|
+
'smart': smart,
|
|
148
|
+
'folder': test_folder,
|
|
149
|
+
'sheet': sheet,
|
|
150
|
+
'sheet_primary_col': sheet_primary_col,
|
|
151
|
+
'sheet_b': sheet_b,
|
|
152
|
+
'sheet_b_primary_col': sheet_b_primary_col,
|
|
153
|
+
'now': now,
|
|
154
|
+
'users': fixusers,
|
|
155
|
+
'groups': groups
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
def smart_teardown():
|
|
159
|
+
action = fixture['smart'].Sheets.delete_sheet(fixture['sheet'].id)
|
|
160
|
+
assert action.message == 'SUCCESS'
|
|
161
|
+
print("deleted fixture sheet")
|
|
162
|
+
action = fixture['smart'].Sheets.delete_sheet(fixture['sheet_b'].id)
|
|
163
|
+
assert action.message == 'SUCCESS'
|
|
164
|
+
print("deleted fixture sheet_b")
|
|
165
|
+
action = fixture['smart'].Folders.delete_folder(fixture['folder'].id)
|
|
166
|
+
assert action.message == 'SUCCESS'
|
|
167
|
+
print("deleted fixture folder")
|
|
168
|
+
if 'folder_b' in fixture:
|
|
169
|
+
action = fixture['smart'].Folders.delete_folder(fixture['folder_b'].id)
|
|
170
|
+
assert action.message == 'SUCCESS'
|
|
171
|
+
print("deleted fixture folder_b")
|
|
172
|
+
|
|
173
|
+
request.addfinalizer(smart_teardown)
|
|
174
|
+
return fixture
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Curly: "Hmmm, n'yuk, n'yuk, n'yuk. He must be a Pointsetter!"
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
n'yuk, n'yuk, n'yuk!
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import os.path
|
|
3
|
+
|
|
4
|
+
_dir = os.path.dirname(os.path.abspath(__file__))
|
|
5
|
+
|
|
6
|
+
@pytest.mark.usefixtures("smart_setup")
|
|
7
|
+
class TestAttachments:
|
|
8
|
+
row_url_attachment = None
|
|
9
|
+
sheet_file_attachment = None
|
|
10
|
+
|
|
11
|
+
# SEE TestDiscussions for this test
|
|
12
|
+
# def test_attach_url_to_comment(self, smart_setup):
|
|
13
|
+
# smart = smart_setup['smart']
|
|
14
|
+
|
|
15
|
+
def test_attach_url_to_sheet(self, smart_setup):
|
|
16
|
+
smart = smart_setup['smart']
|
|
17
|
+
url = smart.models.Attachment({
|
|
18
|
+
'name': 'find stuff',
|
|
19
|
+
'description': 'Maybe you have heard of this.',
|
|
20
|
+
'url': 'http://www.google.com/',
|
|
21
|
+
'attachment_type': 'LINK'
|
|
22
|
+
})
|
|
23
|
+
action = smart_setup['sheet_b'].attach_url(url)
|
|
24
|
+
assert action.message == 'SUCCESS'
|
|
25
|
+
|
|
26
|
+
def test_attach_url_to_row(self, smart_setup):
|
|
27
|
+
smart = smart_setup['smart']
|
|
28
|
+
url = smart.models.Attachment({
|
|
29
|
+
'name': 'find stuff',
|
|
30
|
+
'description': 'Maybe you have heard of this.',
|
|
31
|
+
'url': 'http://www.google.com/',
|
|
32
|
+
'attachment_type': 'LINK'
|
|
33
|
+
})
|
|
34
|
+
action = smart.Attachments.attach_url_to_row(
|
|
35
|
+
smart_setup['sheet_b'].id,
|
|
36
|
+
smart_setup['sheet_b'].rows[0].id,
|
|
37
|
+
url
|
|
38
|
+
)
|
|
39
|
+
assert action.message == 'SUCCESS'
|
|
40
|
+
TestAttachments.row_url_attachment = action.result
|
|
41
|
+
|
|
42
|
+
def test_attach_file_to_sheet(self, smart_setup):
|
|
43
|
+
smart = smart_setup['smart']
|
|
44
|
+
action = smart.Attachments.attach_file_to_sheet(
|
|
45
|
+
smart_setup['sheet_b'].id,
|
|
46
|
+
('stooges.jpg', open(_dir + '/fixtures/stooges_v1.jpg', 'rb'), 'image/jpeg')
|
|
47
|
+
)
|
|
48
|
+
assert action.message == 'SUCCESS'
|
|
49
|
+
TestAttachments.sheet_file_attachment = action.result
|
|
50
|
+
|
|
51
|
+
def test_list_all_attachments(self, smart_setup):
|
|
52
|
+
smart = smart_setup['smart']
|
|
53
|
+
action = smart.Attachments.list_all_attachments(
|
|
54
|
+
smart_setup['sheet_b'].id
|
|
55
|
+
)
|
|
56
|
+
assert action.total_count > 0
|
|
57
|
+
|
|
58
|
+
def test_attach_new_version(self, smart_setup):
|
|
59
|
+
smart = smart_setup['smart']
|
|
60
|
+
action = smart.Attachments.attach_new_version(
|
|
61
|
+
smart_setup['sheet_b'].id,
|
|
62
|
+
TestAttachments.sheet_file_attachment.id,
|
|
63
|
+
('stooges.jpg', open(_dir + '/fixtures/stooges_v2.jpg', 'rb'), 'image/jpeg')
|
|
64
|
+
)
|
|
65
|
+
assert action.message == 'SUCCESS'
|
|
66
|
+
|
|
67
|
+
def test_list_attachment_versions(self, smart_setup):
|
|
68
|
+
smart = smart_setup['smart']
|
|
69
|
+
action = smart.Attachments.list_attachment_versions(
|
|
70
|
+
smart_setup['sheet_b'].id,
|
|
71
|
+
TestAttachments.sheet_file_attachment.id
|
|
72
|
+
)
|
|
73
|
+
assert action.total_count > 0
|
|
74
|
+
vlist = action.result
|
|
75
|
+
assert isinstance(action.result[0], smart.models.attachment.Attachment)
|
|
76
|
+
|
|
77
|
+
def test_delete_attachment(self, smart_setup):
|
|
78
|
+
smart = smart_setup['smart']
|
|
79
|
+
action = smart.Attachments.delete_attachment(
|
|
80
|
+
smart_setup['sheet_b'].id,
|
|
81
|
+
TestAttachments.row_url_attachment.id
|
|
82
|
+
)
|
|
83
|
+
assert action.message == 'SUCCESS'
|
|
84
|
+
|
|
85
|
+
def test_get_attachment(self, smart_setup):
|
|
86
|
+
smart = smart_setup['smart']
|
|
87
|
+
file = smart.Attachments.get_attachment(
|
|
88
|
+
smart_setup['sheet_b'].id,
|
|
89
|
+
TestAttachments.sheet_file_attachment.id
|
|
90
|
+
)
|
|
91
|
+
assert file.name == 'stooges.jpg'
|
|
92
|
+
|
|
93
|
+
def test_delete_attachment_versions(self, smart_setup):
|
|
94
|
+
smart = smart_setup['smart']
|
|
95
|
+
action = smart.Attachments.delete_attachment_versions(
|
|
96
|
+
smart_setup['sheet_b'].id,
|
|
97
|
+
TestAttachments.sheet_file_attachment.id
|
|
98
|
+
)
|
|
99
|
+
assert action.message == 'SUCCESS'
|