ciocore 9.0.0b2__py2.py3-none-any.whl → 9.1.0__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.
Potentially problematic release.
This version of ciocore might be problematic. Click here for more details.
- ciocore/VERSION +1 -1
- ciocore/api_client.py +7 -4
- ciocore/data.py +4 -2
- ciocore/docsite/apidoc/api_client/index.html +14 -4
- ciocore/docsite/apidoc/data/index.html +11 -3
- ciocore/docsite/search/search_index.json +1 -1
- ciocore/docsite/sitemap.xml.gz +0 -0
- {ciocore-9.0.0b2.dist-info → ciocore-9.1.0.dist-info}/METADATA +12 -7
- {ciocore-9.0.0b2.dist-info → ciocore-9.1.0.dist-info}/RECORD +14 -16
- tests/test_config.py +15 -4
- tests/test_data.py +167 -154
- tests/extra_env_fixtures.py +0 -57
- tests/project_fixtures.py +0 -8
- {ciocore-9.0.0b2.dist-info → ciocore-9.1.0.dist-info}/WHEEL +0 -0
- {ciocore-9.0.0b2.dist-info → ciocore-9.1.0.dist-info}/entry_points.txt +0 -0
- {ciocore-9.0.0b2.dist-info → ciocore-9.1.0.dist-info}/top_level.txt +0 -0
ciocore/docsite/sitemap.xml.gz
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ciocore
|
|
3
|
-
Version: 9.0
|
|
3
|
+
Version: 9.1.0
|
|
4
4
|
Summary: Core functionality for Conductor's client tools
|
|
5
5
|
Home-page: https://github.com/ConductorTechnologies/ciocore
|
|
6
6
|
Author: conductor
|
|
@@ -34,8 +34,10 @@ conductor --help
|
|
|
34
34
|
Get help for a specific sub command
|
|
35
35
|
```bash
|
|
36
36
|
conductor downloader --help
|
|
37
|
-
conductor
|
|
38
|
-
conductor
|
|
37
|
+
conductor upload --help
|
|
38
|
+
conductor download --help
|
|
39
|
+
conductor packages --help
|
|
40
|
+
conductor docs --help
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
Example API usage
|
|
@@ -50,11 +52,14 @@ See [CONTRIBUTING](CONTRIBUTING.md)
|
|
|
50
52
|
|
|
51
53
|
## Changelog
|
|
52
54
|
|
|
53
|
-
##
|
|
55
|
+
## Version:9.1.0 -- 20 Dec 2024
|
|
54
56
|
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
57
|
+
* Added support for new required JWT authentication parameters
|
|
58
|
+
* Removed Python 2.7 compatibility to focus on modern Python versions
|
|
59
|
+
|
|
60
|
+
## Version:8.3.3 -- 04 Dec 2024
|
|
61
|
+
|
|
62
|
+
* Adds filter option for API data query
|
|
58
63
|
|
|
59
64
|
## Version:8.3.2 -- 01 Oct 2024
|
|
60
65
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
ciocore/VERSION,sha256=
|
|
1
|
+
ciocore/VERSION,sha256=oeEalLUyaZE99NMQp_coGOAHFp5-0eaircSPsG9vXjA,5
|
|
2
2
|
ciocore/__init__.py,sha256=aTP7LeeosQA8BZE67gDV4jgfTK5zxmwZRjiTRu_ZWj0,646
|
|
3
|
-
ciocore/api_client.py,sha256=
|
|
3
|
+
ciocore/api_client.py,sha256=KKL7TsYygNcfkFZDPPq1CSJsrVN_QLK4PqP44vXsCQg,33101
|
|
4
4
|
ciocore/cli.py,sha256=jZ1lOKQiUcrMhsVmD9SVmPMFwHtgDF4SaoAf2-PBS54,15449
|
|
5
5
|
ciocore/client_db.py,sha256=tTz3bl2xeDPPcYSDS3g3QgV_xYihJMx0Kj6OeN2klK0,12978
|
|
6
6
|
ciocore/common.py,sha256=mBIS6KiYoQsjWe6aIFUGRRvCMl8BIN2kmLZ4J8icap8,14982
|
|
7
7
|
ciocore/conductor_submit.py,sha256=bxvzdyNzscAOOOsqTvAYh5DQsTWyCQJNb16Mf-n_F0M,9702
|
|
8
8
|
ciocore/config.py,sha256=rCL7kaFn1tYgSglN8q9Wx6SwMpoXTq0BMQGwPRVwVIg,8973
|
|
9
|
-
ciocore/data.py,sha256=
|
|
9
|
+
ciocore/data.py,sha256=zT3zpkSbHPHHGlLeLDTbwkB8_-Ct6zd8qQ-7U1pDCHM,7215
|
|
10
10
|
ciocore/exceptions.py,sha256=4Oq-WX-qiN6kPUdBCHvvd6mtSQ0nCkDbJxWt2CNtpv8,1504
|
|
11
11
|
ciocore/file_utils.py,sha256=swA7th9WhDEloW69YViRTKB-oeC9UmNdEGegfH1r-Gw,17176
|
|
12
12
|
ciocore/hardware_set.py,sha256=FlRQiGCLRcSW7Oko_gzgVK8ZqJ_J92eT8e_AleAbS2E,17047
|
|
@@ -25,11 +25,11 @@ ciocore/docsite/index.html,sha256=NEK4HaX2yaetTajVtQuTmS9C5cPnkAtxgeKEj7wQ9t0,20
|
|
|
25
25
|
ciocore/docsite/logo.png,sha256=gArgFFWdw8w985-0TkuGIgU_pW9sziEMZdqytXb5WLo,2825
|
|
26
26
|
ciocore/docsite/objects.inv,sha256=XwmLactPEWWC4fAWqHNPBXGsluRxLLTrwDLQqq51ONY,775
|
|
27
27
|
ciocore/docsite/sitemap.xml,sha256=M_V85zl0y2adRvzJAnoCxlZH_Hl7TLnIb1A-6l_xGmI,109
|
|
28
|
-
ciocore/docsite/sitemap.xml.gz,sha256=
|
|
29
|
-
ciocore/docsite/apidoc/api_client/index.html,sha256=
|
|
28
|
+
ciocore/docsite/sitemap.xml.gz,sha256=Y8-yQgTp14BttP0hYQecQsezVFbeBMuGGX7cygjyTKM,127
|
|
29
|
+
ciocore/docsite/apidoc/api_client/index.html,sha256=kkhKzA7OThkpASLveONRPNS7gGppf8Ot2rxek1lZxHc,189722
|
|
30
30
|
ciocore/docsite/apidoc/apidoc/index.html,sha256=GOSvv6KZPOtgekgshRE4j7aDvJkkaiBQLwA_By9J94g,26171
|
|
31
31
|
ciocore/docsite/apidoc/config/index.html,sha256=WDqy4MLR3EMp9T_2-Z9Op61rTFkvb0aTWmtjiR8sbjA,72559
|
|
32
|
-
ciocore/docsite/apidoc/data/index.html,sha256=
|
|
32
|
+
ciocore/docsite/apidoc/data/index.html,sha256=8ldmfisgelzdWtTqGY8uebvVRcskhbv-reO3hMcIgGI,51627
|
|
33
33
|
ciocore/docsite/apidoc/hardware_set/index.html,sha256=SpYg-lwuCvfLPbNIIM7aQL2jGt-NA5wlVMlIKixGwBo,123042
|
|
34
34
|
ciocore/docsite/apidoc/package_environment/index.html,sha256=V6_ah3V1_4_aOwJbEcITCdwuHxe1vGtfn0maRrbflUs,69248
|
|
35
35
|
ciocore/docsite/apidoc/package_tree/index.html,sha256=5_4vV8x_GmpsyWHnMP62gBaAcdzfM7L-mP7uQKh_DH4,109054
|
|
@@ -80,7 +80,7 @@ ciocore/docsite/cmdline/downloader/index.html,sha256=nygj-0GQmpD79B5AxHjwzQxOFv8
|
|
|
80
80
|
ciocore/docsite/cmdline/packages/index.html,sha256=_kXB85PBAgrqW09OerYpxnJuyERHMbcLn6qBGRdyHwk,20923
|
|
81
81
|
ciocore/docsite/cmdline/uploader/index.html,sha256=vuQ06Gys9Eoxs87PXlqnM5AgB6Ag00BlDIy6oaprjis,25123
|
|
82
82
|
ciocore/docsite/how-to-guides/index.html,sha256=KifCHl2S3RfPBZhP1UXwUNWuhcXPlPPqM4Gk6rVGhjQ,20100
|
|
83
|
-
ciocore/docsite/search/search_index.json,sha256=
|
|
83
|
+
ciocore/docsite/search/search_index.json,sha256=LP1ck_wuTP9A_dWTyaVF8Fugg22q1O0XS6hGqg2zk0M,189860
|
|
84
84
|
ciocore/docsite/stylesheets/extra.css,sha256=_Cxe9Dhg1BBi6Kqaz_iZD9z9VyqxA9vtONRjP4PVic0,354
|
|
85
85
|
ciocore/docsite/stylesheets/tables.css,sha256=LE_zwGRxGcdPIy-9QiVPecOzlEBSqZb_WP5vDkFE0ZM,3235
|
|
86
86
|
ciocore/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -98,16 +98,14 @@ ciocore/uploader/_uploader.py,sha256=40nzqO5DuFi4sx31VvjWxZPNkrWsWqM9jtFVxs_-o3o
|
|
|
98
98
|
ciocore/uploader/upload_stats/__init__.py,sha256=Lg1y4zq1i0cwc6Hh2K1TAQDYymLff49W-uIo1xjcvdI,5309
|
|
99
99
|
ciocore/uploader/upload_stats/stats_formats.py,sha256=giNirtObU66VALWghPFSRhg3q_vw5MvESsnXhb_I3y8,2402
|
|
100
100
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
101
|
-
tests/extra_env_fixtures.py,sha256=8qvU4d8SXGKzRVNR5whVqKCQOwOVMiFVfbKBAjxa2gE,1119
|
|
102
101
|
tests/instance_type_fixtures.py,sha256=uIzQduqKQVgjllMuyXaYnRC-pwqk5lnTx3NY2M5Nujo,4320
|
|
103
102
|
tests/package_fixtures.py,sha256=od7ZHofG8ubpQ3PqlUsrcHBcbmD3qVWih9eiIg1WtSQ,5361
|
|
104
|
-
tests/project_fixtures.py,sha256=iBm_th_JtAw76vlNu7Jjhh9tLH4oOaNi-MgtPzCV7yQ,138
|
|
105
103
|
tests/test_api_client.py,sha256=isntMDs3QTyTWdghBa_LbFAiC7ydZD1RWb655oEZo24,14452
|
|
106
104
|
tests/test_base_downloader.py,sha256=SS7tWKv2ZZhpUDk4UCg1TkrNrpntjSewgzLl1mEubSE,3603
|
|
107
105
|
tests/test_cli.py,sha256=_WTs2SWlEgd6wtg1hmOBlFnbWVdFLvqp0KqNhy-y2e8,5532
|
|
108
106
|
tests/test_common.py,sha256=5N9xeeGVuwN4kcjIg30eBliUD8PePzCNNLuLipGuTgk,410
|
|
109
|
-
tests/test_config.py,sha256=
|
|
110
|
-
tests/test_data.py,sha256=
|
|
107
|
+
tests/test_config.py,sha256=ahDLB6yVX8pA-B1qvxEpcJ1Wf1HS499rEg7lloeyxfk,11526
|
|
108
|
+
tests/test_data.py,sha256=o320GdvOJ2TouWtuA8jcs8Cr_gQWlQ6KxWVSWtmARlY,7614
|
|
111
109
|
tests/test_downloader.py,sha256=hceljsjnuvk5Vk5X4mHgavIEcpbv8ylPwpz7rTwJ-aE,4721
|
|
112
110
|
tests/test_hardware_set.py,sha256=hW7A_suyYdU7WkB7qoHSBPLxaAP2CKqI0i_ULfO5GeY,4408
|
|
113
111
|
tests/test_imports_2and3.py,sha256=ehqpRYPVY7djBcb8OT_cnh86iCJJ9wuMWnfSR9RHxmY,507
|
|
@@ -120,8 +118,8 @@ tests/test_uploader.py,sha256=JGp6GEyqRXRtbQSb-IW-cCX_BzNotWdCbnJnLwZvpUM,2869
|
|
|
120
118
|
tests/test_validator.py,sha256=2fY66ayNc08PGyj2vTI-V_1yeCWJDngkj2zkUM5TTCI,1526
|
|
121
119
|
tests/mocks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
122
120
|
tests/mocks/glob.py,sha256=J2MH7nqi6NJOHuGdVWxhfeBd700_Ckj6cLh_8jSNkfg,215
|
|
123
|
-
ciocore-9.0.
|
|
124
|
-
ciocore-9.0.
|
|
125
|
-
ciocore-9.0.
|
|
126
|
-
ciocore-9.0.
|
|
127
|
-
ciocore-9.0.
|
|
121
|
+
ciocore-9.1.0.dist-info/METADATA,sha256=3w70xvtZ8bsQUIZRoZ2uECYlDQLPOjW-kUr1oYTQ3GA,19101
|
|
122
|
+
ciocore-9.1.0.dist-info/WHEEL,sha256=qUzzGenXXuJTzyjFah76kDVqDvnk-YDzY00svnrl84w,109
|
|
123
|
+
ciocore-9.1.0.dist-info/entry_points.txt,sha256=cCqcALMYbC4d8545V9w0Zysfg9MVuKWhzDQ2er4UfGE,47
|
|
124
|
+
ciocore-9.1.0.dist-info/top_level.txt,sha256=SvlM5JlqULzAz00JZWfiUhfjhqDzYzSWssA87zdJl0o,14
|
|
125
|
+
ciocore-9.1.0.dist-info/RECORD,,
|
tests/test_config.py
CHANGED
|
@@ -8,7 +8,18 @@ import logging
|
|
|
8
8
|
|
|
9
9
|
from unittest import mock
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
MOCK_API_KEY = '''{
|
|
12
|
+
"type": "service_account",
|
|
13
|
+
"project_id": "mock-project",
|
|
14
|
+
"private_key_id": "mock-key-id",
|
|
15
|
+
"private_key": "-----BEGIN PRIVATE KEY-----\\nMOCKKEY\\n-----END PRIVATE KEY-----\\n",
|
|
16
|
+
"client_email": "mock@example.com",
|
|
17
|
+
"client_id": "123456789",
|
|
18
|
+
"auth_uri": "https://accounts.example.com/oauth2/auth",
|
|
19
|
+
"token_uri": "https://oauth2.example.com/token",
|
|
20
|
+
"auth_provider_x509_cert_url": "https://www.example.com/oauth2/v1/certs",
|
|
21
|
+
"client_x509_cert_url": "https://www.example.com/robot/v1/metadata/x509/mock%40example.com"
|
|
22
|
+
}'''
|
|
12
23
|
|
|
13
24
|
PY3 = sys.version_info >= (3, 0)
|
|
14
25
|
BUILTIN_OPEN = "builtins.open" if PY3 else "__builtin__.open"
|
|
@@ -264,7 +275,7 @@ class ApiKeyFromVariableTest(unittest.TestCase):
|
|
|
264
275
|
self.down()
|
|
265
276
|
|
|
266
277
|
def test_returns_dict_if_key_is_b64encoded(self):
|
|
267
|
-
key =
|
|
278
|
+
key = MOCK_API_KEY
|
|
268
279
|
if sys.version_info < (3, 0):
|
|
269
280
|
self.up(env={"CONDUCTOR_API_KEY": base64.b64encode(key)})
|
|
270
281
|
else:
|
|
@@ -299,7 +310,7 @@ class ApiKeyFromFileTest(unittest.TestCase):
|
|
|
299
310
|
self.assertEqual(result, None)
|
|
300
311
|
self.down()
|
|
301
312
|
|
|
302
|
-
@mock.patch(BUILTIN_OPEN, new_callable=mock.mock_open, read_data=
|
|
313
|
+
@mock.patch(BUILTIN_OPEN, new_callable=mock.mock_open, read_data=MOCK_API_KEY, create=True)
|
|
303
314
|
def test_open_called_with_api_key_path(self, mock_file_open):
|
|
304
315
|
self.up(env={"CONDUCTOR_API_KEY_PATH": "path/to/api_key"})
|
|
305
316
|
config.Config.get_api_key_from_file()
|
|
@@ -313,7 +324,7 @@ class ApiKeyFromFileTest(unittest.TestCase):
|
|
|
313
324
|
config.Config.get_api_key_from_file()
|
|
314
325
|
self.down()
|
|
315
326
|
|
|
316
|
-
@mock.patch(BUILTIN_OPEN, new_callable=mock.mock_open, read_data=
|
|
327
|
+
@mock.patch(BUILTIN_OPEN, new_callable=mock.mock_open, read_data=MOCK_API_KEY, create=True)
|
|
317
328
|
def test_returns_dict_if_key_is_valid_json(self, mock_file_open):
|
|
318
329
|
self.up(env={"CONDUCTOR_API_KEY_PATH": "path/to/api_key"})
|
|
319
330
|
result = config.Config.get_api_key_from_file()
|
tests/test_data.py
CHANGED
|
@@ -1,160 +1,173 @@
|
|
|
1
|
-
""" test data
|
|
2
|
-
|
|
3
|
-
isort:skip_file
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
1
|
import unittest
|
|
2
|
+
from unittest.mock import patch
|
|
3
|
+
from ciocore import data as coredata
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
from ciocore import data
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
from project_fixtures import PROJECTS
|
|
14
|
-
from package_fixtures import SOFTWARE_DATA
|
|
15
|
-
from instance_type_fixtures import LIN_INSTANCE_TYPES, ALL_INSTANCE_TYPES
|
|
16
|
-
|
|
17
|
-
class TestDataAllInstanceTypes(unittest.TestCase):
|
|
5
|
+
class TestCoreData(unittest.TestCase):
|
|
18
6
|
def setUp(self):
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
"""Set up test fixtures before each test method."""
|
|
8
|
+
self.mock_api_responses = {
|
|
9
|
+
'projects': ['ProjectA', 'ProjectB'],
|
|
10
|
+
'instance_types': [
|
|
11
|
+
{'operating_system': 'windows', 'name': 'win_machine', 'cores': 1, 'memory': '1024'},
|
|
12
|
+
{'operating_system': 'linux', 'name': 'linux_machine', 'cores': 1, 'memory': '1024'}
|
|
13
|
+
],
|
|
14
|
+
'software': [ # Added package_id to each package
|
|
15
|
+
{
|
|
16
|
+
'name': 'maya-io',
|
|
17
|
+
'version': '2022',
|
|
18
|
+
'platform': 'windows',
|
|
19
|
+
'product': 'maya-io',
|
|
20
|
+
'package_id': '123456789'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
'name': 'maya-io',
|
|
24
|
+
'version': '2022',
|
|
25
|
+
'platform': 'linux',
|
|
26
|
+
'product': 'maya-io',
|
|
27
|
+
'package_id': '123456780'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
'name': 'nuke',
|
|
31
|
+
'version': '13.0',
|
|
32
|
+
'platform': 'linux',
|
|
33
|
+
'product': 'nuke',
|
|
34
|
+
'package_id': '123456781'
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
'extra_env': ['PATH=/custom/path', 'LICENSE_SERVER=1234']
|
|
23
38
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# self.account_id_patcher = mock.patch(
|
|
28
|
-
# "ciocore.data.get_account_id", return_value="1234"
|
|
29
|
-
# )
|
|
30
|
-
|
|
31
|
-
# self.mock_get_data = self.get_data_patcher.start()
|
|
32
|
-
# self.mock_account_id = self.account_id_patcher.start()
|
|
33
|
-
|
|
34
|
-
data.__data__ = {}
|
|
35
|
-
data.__products__ = None
|
|
39
|
+
# Clear data before each test
|
|
40
|
+
coredata.clear()
|
|
36
41
|
|
|
37
42
|
def tearDown(self):
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
43
|
+
"""Clean up after each test method."""
|
|
44
|
+
coredata.clear()
|
|
45
|
+
|
|
46
|
+
def test_init_with_single_product(self):
|
|
47
|
+
"""Test initializing with a single product"""
|
|
48
|
+
coredata.init("maya-io")
|
|
49
|
+
self.assertEqual(coredata.products(), ["maya-io"])
|
|
50
|
+
self.assertEqual(coredata.platforms(), set(["windows", "linux"]))
|
|
51
|
+
|
|
52
|
+
def test_init_with_multiple_products(self):
|
|
53
|
+
"""Test initializing with multiple products"""
|
|
54
|
+
coredata.init("maya-io", "nuke")
|
|
55
|
+
self.assertEqual(coredata.products(), ["maya-io", "nuke"])
|
|
56
|
+
|
|
57
|
+
def test_init_with_deprecated_product(self):
|
|
58
|
+
"""Test initializing with deprecated product kwarg"""
|
|
59
|
+
coredata.init(product="maya-io")
|
|
60
|
+
self.assertEqual(coredata.products(), ["maya-io"])
|
|
61
|
+
|
|
62
|
+
def test_init_with_all_products(self):
|
|
63
|
+
"""Test initializing with 'all' products"""
|
|
64
|
+
coredata.init(product="all")
|
|
65
|
+
self.assertEqual(coredata.products(), [])
|
|
66
|
+
|
|
67
|
+
def test_init_conflict_raises_error(self):
|
|
68
|
+
"""Test that using both products arg and product kwarg raises error"""
|
|
69
|
+
with self.assertRaises(ValueError):
|
|
70
|
+
coredata.init("maya-io", product="nuke")
|
|
71
|
+
|
|
72
|
+
def test_data_requires_init(self):
|
|
73
|
+
"""Test that data() raises error if not initialized"""
|
|
74
|
+
with self.assertRaises(ValueError):
|
|
75
|
+
coredata.data()
|
|
76
|
+
|
|
77
|
+
@patch('ciocore.data.api_client')
|
|
78
|
+
def test_data_fetching(self, mock_client):
|
|
79
|
+
"""Test fetching data through the data() function"""
|
|
80
|
+
# Setup mock responses
|
|
81
|
+
mock_client.request_projects.return_value = self.mock_api_responses['projects']
|
|
82
|
+
mock_client.request_instance_types.return_value = self.mock_api_responses['instance_types']
|
|
83
|
+
mock_client.request_software_packages.return_value = self.mock_api_responses['software']
|
|
84
|
+
mock_client.request_extra_environment.return_value = self.mock_api_responses['extra_env']
|
|
85
|
+
|
|
86
|
+
coredata.init("maya-io")
|
|
87
|
+
result = coredata.data()
|
|
88
|
+
|
|
89
|
+
self.assertIn("projects", result)
|
|
90
|
+
self.assertIn("instance_types", result)
|
|
91
|
+
self.assertIn("software", result)
|
|
92
|
+
self.assertIn("extra_environment", result)
|
|
93
|
+
|
|
94
|
+
self.assertEqual(result["projects"], self.mock_api_responses["projects"])
|
|
95
|
+
self.assertIsInstance(result["instance_types"], coredata.HardwareSet)
|
|
96
|
+
self.assertIsInstance(result["software"], coredata.PackageTree)
|
|
97
|
+
|
|
98
|
+
@patch('ciocore.data.api_client')
|
|
99
|
+
def test_force_refresh(self, mock_client):
|
|
100
|
+
"""Test forcing data refresh"""
|
|
101
|
+
# Setup mock responses
|
|
102
|
+
mock_client.request_projects.return_value = self.mock_api_responses['projects']
|
|
103
|
+
mock_client.request_instance_types.return_value = self.mock_api_responses['instance_types']
|
|
104
|
+
mock_client.request_software_packages.return_value = self.mock_api_responses['software']
|
|
105
|
+
mock_client.request_extra_environment.return_value = self.mock_api_responses['extra_env']
|
|
106
|
+
|
|
107
|
+
coredata.init("maya-io")
|
|
108
|
+
first_data = coredata.data()
|
|
109
|
+
|
|
110
|
+
# Second call without force should not make new API calls
|
|
111
|
+
mock_client.request_projects.reset_mock()
|
|
112
|
+
second_data = coredata.data()
|
|
113
|
+
mock_client.request_projects.assert_not_called()
|
|
114
|
+
|
|
115
|
+
# Call with force=True should make new API calls
|
|
116
|
+
third_data = coredata.data(force=True)
|
|
117
|
+
mock_client.request_projects.assert_called_once()
|
|
118
|
+
|
|
119
|
+
def test_valid_state(self):
|
|
120
|
+
"""Test valid() function behavior"""
|
|
121
|
+
self.assertFalse(coredata.valid()) # Should be invalid before initialization
|
|
122
|
+
|
|
123
|
+
coredata.init("maya-io")
|
|
124
|
+
self.assertFalse(coredata.valid()) # Should be invalid before data is fetched
|
|
125
|
+
|
|
126
|
+
with patch('ciocore.data.api_client') as mock_client:
|
|
127
|
+
# Setup mock responses
|
|
128
|
+
mock_client.request_projects.return_value = self.mock_api_responses['projects']
|
|
129
|
+
mock_client.request_instance_types.return_value = self.mock_api_responses['instance_types']
|
|
130
|
+
mock_client.request_software_packages.return_value = self.mock_api_responses['software']
|
|
131
|
+
mock_client.request_extra_environment.return_value = self.mock_api_responses['extra_env']
|
|
132
|
+
|
|
133
|
+
coredata.data() # Fetch data
|
|
134
|
+
self.assertTrue(coredata.valid()) # Should be valid after data is fetched
|
|
135
|
+
|
|
136
|
+
coredata.clear()
|
|
137
|
+
self.assertFalse(coredata.valid()) # Should be invalid after clear
|
|
138
|
+
|
|
139
|
+
@patch('ciocore.data.api_client')
|
|
140
|
+
def test_platforms_filtering(self, mock_client):
|
|
141
|
+
"""Test platform filtering based on instance types and software"""
|
|
142
|
+
# Setup mock responses
|
|
143
|
+
mock_client.request_projects.return_value = self.mock_api_responses['projects']
|
|
144
|
+
mock_client.request_instance_types.return_value = self.mock_api_responses['instance_types']
|
|
145
|
+
mock_client.request_software_packages.return_value = self.mock_api_responses['software']
|
|
146
|
+
mock_client.request_extra_environment.return_value = self.mock_api_responses['extra_env']
|
|
147
|
+
|
|
148
|
+
coredata.init("nuke") # nuke only supports linux
|
|
149
|
+
coredata.data()
|
|
150
|
+
|
|
151
|
+
# Should only have linux instance types since nuke only supports linux
|
|
152
|
+
self.assertEqual(coredata.platforms(), {"linux"})
|
|
153
|
+
|
|
154
|
+
@patch('ciocore.data.api_client')
|
|
155
|
+
def test_instances_filter(self, mock_client):
|
|
156
|
+
"""Testing that instance_types is passed correctly to api_client"""
|
|
157
|
+
# Set up mock response
|
|
158
|
+
mock_client.request_instance_types.return_value = self.mock_api_responses['instance_types']
|
|
159
|
+
coredata.init("maya-io")
|
|
160
|
+
|
|
161
|
+
# Test with no filter
|
|
162
|
+
coredata.data()
|
|
163
|
+
mock_client.request_instance_types.assert_called_with(filter_param="")
|
|
164
|
+
|
|
165
|
+
# Test with filter and force=True
|
|
166
|
+
mock_client.request_instance_types.reset_mock()
|
|
167
|
+
|
|
168
|
+
instances_filter = "gpu.gpu_count=gte:1:int"
|
|
169
|
+
coredata.data(force=True, instances_filter=instances_filter)
|
|
170
|
+
mock_client.request_instance_types.assert_called_with(filter_param=instances_filter)
|
|
171
|
+
|
|
172
|
+
if __name__ == '__main__':
|
|
173
|
+
unittest.main()
|
tests/extra_env_fixtures.py
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
EXTRA_ENV = [
|
|
4
|
-
{
|
|
5
|
-
"account_id": "6649535867387904",
|
|
6
|
-
"env": [],
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"account_id": "5767615549800448",
|
|
10
|
-
"env": [
|
|
11
|
-
{
|
|
12
|
-
"merge_policy": "prepend",
|
|
13
|
-
"name": "test",
|
|
14
|
-
"value": "test"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"account_id": "6649535867387904",
|
|
20
|
-
"env": [],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"account_id": "5669544198668288",
|
|
24
|
-
"env": [
|
|
25
|
-
{
|
|
26
|
-
"merge_policy": "append",
|
|
27
|
-
"name": "PATH",
|
|
28
|
-
"value": "/path/to/scripts"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"merge_policy": "exclusive",
|
|
32
|
-
"name": "RENDER_LOCATION",
|
|
33
|
-
"value": "cloud"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"merge_policy": "exclusive",
|
|
37
|
-
"name": "VARIABLE_USED_IN_SCRIPTS",
|
|
38
|
-
"value": "true"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"merge_policy": "exclusive",
|
|
42
|
-
"name": "testvar",
|
|
43
|
-
"value": "somevalue"
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"account_id": "6649535867387904",
|
|
49
|
-
"env": [
|
|
50
|
-
{
|
|
51
|
-
"merge_policy": "exclusive",
|
|
52
|
-
"name": "JMEYER",
|
|
53
|
-
"value": "JMEYER_ENV_VALUE"
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
}
|
|
57
|
-
]
|
tests/project_fixtures.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|