ciocore 8.0.0b27__py2.py3-none-any.whl → 8.0.0b29__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 +32 -0
- ciocore/cli.py +1 -1
- ciocore/data.py +8 -0
- ciocore/docsite/apidoc/api_client/index.html +67 -0
- ciocore/docsite/apidoc/data/index.html +8 -0
- ciocore/docsite/objects.inv +0 -0
- ciocore/docsite/search/search_index.json +1 -1
- ciocore/docsite/sitemap.xml.gz +0 -0
- ciocore/downloader/download_runner_base.py +1 -1
- {ciocore-8.0.0b27.dist-info → ciocore-8.0.0b29.dist-info}/METADATA +12 -58
- {ciocore-8.0.0b27.dist-info → ciocore-8.0.0b29.dist-info}/RECORD +18 -17
- tests/extra_env_fixtures.py +57 -0
- tests/test_api_client.py +60 -1
- tests/test_base_downloader.py +4 -4
- {ciocore-8.0.0b27.dist-info → ciocore-8.0.0b29.dist-info}/WHEEL +0 -0
- {ciocore-8.0.0b27.dist-info → ciocore-8.0.0b29.dist-info}/entry_points.txt +0 -0
- {ciocore-8.0.0b27.dist-info → ciocore-8.0.0b29.dist-info}/top_level.txt +0 -0
ciocore/docsite/sitemap.xml.gz
CHANGED
|
Binary file
|
|
@@ -37,7 +37,7 @@ class DownloadRunnerBase(object):
|
|
|
37
37
|
"""
|
|
38
38
|
Run the downloader.
|
|
39
39
|
|
|
40
|
-
Optionally wrap the
|
|
40
|
+
Optionally wrap the downloader in a reporter to report task statuses back to the server.
|
|
41
41
|
"""
|
|
42
42
|
if self.disable_reporting:
|
|
43
43
|
self.downloader.run()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ciocore
|
|
3
|
-
Version: 8.0.
|
|
3
|
+
Version: 8.0.0b29
|
|
4
4
|
Summary: Core functionality for Conductor's client tools
|
|
5
5
|
Home-page: https://github.com/ConductorTechnologies/ciocore
|
|
6
6
|
Author: conductor
|
|
@@ -51,63 +51,17 @@ See [CONTRIBUTING](CONTRIBUTING.md)
|
|
|
51
51
|
|
|
52
52
|
## Changelog
|
|
53
53
|
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* Add file filtering functionality to BaseDownloader and its subclasses
|
|
66
|
-
* Ensure log to stdout so that it's greppable
|
|
67
|
-
|
|
68
|
-
* 8.0.0-beta.20
|
|
69
|
-
* Colored logging and better error detection when request for url fails.
|
|
70
|
-
|
|
71
|
-
* 8.0.0-beta.19
|
|
72
|
-
* Refactor and improvements to threading and logging.
|
|
73
|
-
|
|
74
|
-
* 8.0.0-beta.18
|
|
75
|
-
* Adds robustness to handling of Ctrl+C, errors, threads, and logging.
|
|
76
|
-
|
|
77
|
-
* 8.0.0-beta.17
|
|
78
|
-
* Ignores redundant tasks in the download queue
|
|
79
|
-
|
|
80
|
-
* 8.0.0-beta.15
|
|
81
|
-
* remove sequence checker and unnecessary dependencies
|
|
82
|
-
|
|
83
|
-
* 8.0.0-beta.14
|
|
84
|
-
* fixed permissions error bug with file downloads
|
|
85
|
-
|
|
86
|
-
* 8.0.0-beta.13
|
|
87
|
-
* fixed permissions error bug with file downloads
|
|
88
|
-
|
|
89
|
-
* 8.0.0-beta.5
|
|
90
|
-
* adds kill_tasks kill_jobs get_jobs get_log
|
|
91
|
-
* remove old docs stuff
|
|
92
|
-
|
|
93
|
-
* 8.0.0-beta.4
|
|
94
|
-
* updates in changelog for dev
|
|
95
|
-
* dev updates in changelog
|
|
96
|
-
* minor
|
|
97
|
-
* refactor datacache to use tables
|
|
98
|
-
* some python 3 updates
|
|
99
|
-
* fixed bug where read_creds hung
|
|
100
|
-
* requests+chardet as charset_normalizer breaks m23
|
|
101
|
-
* Adds DataCache class and tests
|
|
102
|
-
* adds data cache instead of fixtures
|
|
103
|
-
* cull bad 3dsmax entries
|
|
104
|
-
* start data_cache
|
|
105
|
-
* tidy based on comparison with ref repo
|
|
106
|
-
* some formatting and fstrings
|
|
107
|
-
* minor uploader additions
|
|
108
|
-
* adds build_docs back in to cicd
|
|
109
|
-
* skulk 3 compatibility
|
|
110
|
-
* wip testing page downloader
|
|
54
|
+
## Version: 8.0.0-beta.29 -- 30 Mar 2024
|
|
55
|
+
|
|
56
|
+
Major Updates in Version 8.0.0
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
* The `conductor` commandline interface (CLI) has undergone a complete overhaul to improve its functionality and performance. It is now installed as a Python console script, which simplifies the installation process on all platforms and ensures that the tool is always accessible. In addition, this standardized installation allows for better integration into our Companion application and potentially customers' own proprietary tools.
|
|
60
|
+
* The commandline downloader has been rewritten to improve its performance and reliability. In previous versions, the downloader would fetch all download URLs from the server before starting any downloads. This approach was inefficient and would lead to performance issues when handling jobs with large numbers of tasks. The new downloader fetches tasks in small batches, which allows the download to start almost immediately, regardless of the number of tasks. It provides several new commandline flags, such as filtering based on filenames, and better logging, giving users more control and visibility over the download process. In addition, the new downloader has been written as an event based system that can be seamlessly integrated into other pipeline tools and GUIs. Pipeline TDs need only to register handlers to any of the events that the downloader emits.
|
|
61
|
+
* The `conductor` commandline now supports a new subcommand, `docs`, which opens API and commandline documentation in a local web browser. The documentation is generated using `mkdocs` and is included in the package. This command is useful as it ensures the **API** documentation is relevant to the version of the tool being used.
|
|
62
|
+
* The `conductor` commandline now supports a new subcommand, `packages`, which displays all available software packages on Conductor's cloud. The command can output the document as text, markdown, or nicely formatted HTML. The data is pulled from the Conductor server and is always up-to-date.
|
|
63
|
+
* The Python API now provides four new endpoints: `kill_tasks`, `kill_jobs`, `get_jobs`, and `get_log`.
|
|
64
|
+
* The Python API now provides access to entries in the Dashboard's Extra Environment Variables section. This feature allows administrators to set environment variables that are passed to all jobs run on the cloud. It's especially useful for setting up access to license servers or other shared resources.
|
|
111
65
|
|
|
112
66
|
|
|
113
67
|
## Version:7.0.2 -- 10 Nov 2023
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
ciocore/VERSION,sha256=
|
|
1
|
+
ciocore/VERSION,sha256=XlqO4qN_smGJF38Bz0RcIlXfqSCxhHSod3Bi6Rj2Z8o,13
|
|
2
2
|
ciocore/__init__.py,sha256=aTP7LeeosQA8BZE67gDV4jgfTK5zxmwZRjiTRu_ZWj0,646
|
|
3
|
-
ciocore/api_client.py,sha256=
|
|
4
|
-
ciocore/cli.py,sha256=
|
|
3
|
+
ciocore/api_client.py,sha256=TyHXGmK4uTmKV93O_IpAvttZhbexIIZTGP-IVn_WyWM,24599
|
|
4
|
+
ciocore/cli.py,sha256=BXgULpqElTHwX6nUcSFVVh99MCBSG2FjuOzRKhIa6Hk,15399
|
|
5
5
|
ciocore/client_db.py,sha256=tTz3bl2xeDPPcYSDS3g3QgV_xYihJMx0Kj6OeN2klK0,12978
|
|
6
6
|
ciocore/common.py,sha256=FnggAL-IGW8VQB6kLsrKLnxWFgLpwGBhOtiZSHz130M,14725
|
|
7
7
|
ciocore/compat.py,sha256=5uEXPSog_jxsDMaHBswAKEtfyXT25VgU6WNGIhz9PHU,256
|
|
8
8
|
ciocore/conductor_submit.py,sha256=ONE0LsA5hGavTJIOXXYx8qzl8_vBPADwhd6Ytq_0E0c,9382
|
|
9
9
|
ciocore/config.py,sha256=rCL7kaFn1tYgSglN8q9Wx6SwMpoXTq0BMQGwPRVwVIg,8973
|
|
10
|
-
ciocore/data.py,sha256=
|
|
10
|
+
ciocore/data.py,sha256=Ji0qUk8nJXBNakoHSqBiVx8O58SbZXyt273SHlEDn3U,7027
|
|
11
11
|
ciocore/dev_inst_tagger.py,sha256=bPfoFbE7IPCpDbtbVHxW7IlMwvspdnJhPuNq-u4fJN4,3497
|
|
12
12
|
ciocore/exceptions.py,sha256=4Oq-WX-qiN6kPUdBCHvvd6mtSQ0nCkDbJxWt2CNtpv8,1504
|
|
13
13
|
ciocore/file_utils.py,sha256=bAlL31B4YkRgX-yT8kF8UXBFktQlsE1PvxbKqTeAeOU,17174
|
|
@@ -25,13 +25,13 @@ ciocore/auth/server.py,sha256=8btX9-EokUl6q55V8muDmEV2tvvbTBD0BHeWFbwkzUc,3892
|
|
|
25
25
|
ciocore/docsite/404.html,sha256=DQCrQsaKh8M0zlCFZmjFHUtqy7_gx_i2Rpc3OoDdDI4,17207
|
|
26
26
|
ciocore/docsite/index.html,sha256=p_Dq_6_8cwZZPDI5zjahfCWUkfbSj14NJtoQFAZv0WI,20945
|
|
27
27
|
ciocore/docsite/logo.png,sha256=gArgFFWdw8w985-0TkuGIgU_pW9sziEMZdqytXb5WLo,2825
|
|
28
|
-
ciocore/docsite/objects.inv,sha256=
|
|
28
|
+
ciocore/docsite/objects.inv,sha256=s2FKStLlVIQbfG7U2-nw-7rz4unvd1W0u00YtLBxAKo,758
|
|
29
29
|
ciocore/docsite/sitemap.xml,sha256=M_V85zl0y2adRvzJAnoCxlZH_Hl7TLnIb1A-6l_xGmI,109
|
|
30
|
-
ciocore/docsite/sitemap.xml.gz,sha256=
|
|
31
|
-
ciocore/docsite/apidoc/api_client/index.html,sha256=
|
|
30
|
+
ciocore/docsite/sitemap.xml.gz,sha256=w5DLJrlr2lrhIadg85ABMEdEM0uhOIlOUoYF7J_4zjQ,127
|
|
31
|
+
ciocore/docsite/apidoc/api_client/index.html,sha256=mHDq-zdWuilDKUluzmQNdOsImRoGEnnK5Ul2ApajgdU,170218
|
|
32
32
|
ciocore/docsite/apidoc/apidoc/index.html,sha256=NQn8wjapxa7O2IQhsbE7Y-VMfMFL6Tby-L7qIF6K3m4,26171
|
|
33
33
|
ciocore/docsite/apidoc/config/index.html,sha256=1GWkyClM7LJlLBpx07BqCi3xDkU-SKVPjNUEeKuwbNs,72559
|
|
34
|
-
ciocore/docsite/apidoc/data/index.html,sha256=
|
|
34
|
+
ciocore/docsite/apidoc/data/index.html,sha256=9DonjpASPYZGYRHjyaodkK3AxSlTHsvm1xdq2cqMxPI,50850
|
|
35
35
|
ciocore/docsite/apidoc/hardware_set/index.html,sha256=DMlpzQCy2ypJ078tcFNrZAvG2sU7P5-ZwU4ZRCObtQg,123042
|
|
36
36
|
ciocore/docsite/apidoc/package_environment/index.html,sha256=S5IE1EgnJaaLVsEpgPogwBvj3jxT6ycNp-1GAlJrPt4,65729
|
|
37
37
|
ciocore/docsite/apidoc/package_tree/index.html,sha256=wKW5dsHBlcDyvCGakSNzYHX8z99F1Vhu2NyqAW6c1ko,109393
|
|
@@ -82,12 +82,12 @@ ciocore/docsite/cmdline/downloader/index.html,sha256=DAVErhWEPuEtkQr7y9D_wjylzM9
|
|
|
82
82
|
ciocore/docsite/cmdline/packages/index.html,sha256=j1YeMgdwZ6FyJGJii05AdtUWKRjyu1fOr3_bKJsLfEU,20923
|
|
83
83
|
ciocore/docsite/cmdline/uploader/index.html,sha256=y0728lIAYC4b9mfpjNVfwQqXoqJrsdG49UY5u7B1p94,25123
|
|
84
84
|
ciocore/docsite/how-to-guides/index.html,sha256=OFrFBTb9tuMn60Jd4oeM10Mw-d-0pyqwoKoo9g1biBM,20100
|
|
85
|
-
ciocore/docsite/search/search_index.json,sha256=
|
|
85
|
+
ciocore/docsite/search/search_index.json,sha256=8R5VcEveS35Oe-LACgZF4QjnvO6ds5HhAhyAlRMjOeA,181518
|
|
86
86
|
ciocore/docsite/stylesheets/extra.css,sha256=qgfcao9TEBzf6ieAWN5rPyrea7YM_YgVg5qr4NPrxoU,354
|
|
87
87
|
ciocore/docsite/stylesheets/tables.css,sha256=O2PEwlKC0RfvZCRV9UERqQRvhb6jcqO84PLew0bafF0,3279
|
|
88
88
|
ciocore/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
89
|
ciocore/downloader/base_downloader.py,sha256=9PVmP1qy-dop4MbVsmLFvf5W6LKQLUKHPDYE6AEt71g,25784
|
|
90
|
-
ciocore/downloader/download_runner_base.py,sha256=
|
|
90
|
+
ciocore/downloader/download_runner_base.py,sha256=cWTWKhFX5FLG84Wh8_s7xpk3n0nmQ4fDiD2rYV6a3u0,1612
|
|
91
91
|
ciocore/downloader/job_downloader.py,sha256=HAhr95RyCsj3KTp5W58Znc4JmqHY-mrM5b8vo6kRIJ0,5697
|
|
92
92
|
ciocore/downloader/legacy_downloader.py,sha256=ef9hCMUTTuxYHKzpEoK5bc3gqwAEIhewkC_KpbhLVHE,52087
|
|
93
93
|
ciocore/downloader/log.py,sha256=WCRNx0LObx8JBO5MQucNHQGBXMgSBLGdH0VALN8dFDo,2105
|
|
@@ -100,11 +100,12 @@ ciocore/uploader/_uploader.py,sha256=AaCwRo1rGkdMA-XACx9k4Z73R97ndJUVMemUZNV-Ark
|
|
|
100
100
|
ciocore/uploader/upload_stats/__init__.py,sha256=Lg1y4zq1i0cwc6Hh2K1TAQDYymLff49W-uIo1xjcvdI,5309
|
|
101
101
|
ciocore/uploader/upload_stats/stats_formats.py,sha256=giNirtObU66VALWghPFSRhg3q_vw5MvESsnXhb_I3y8,2402
|
|
102
102
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
103
|
+
tests/extra_env_fixtures.py,sha256=8qvU4d8SXGKzRVNR5whVqKCQOwOVMiFVfbKBAjxa2gE,1119
|
|
103
104
|
tests/instance_type_fixtures.py,sha256=uIzQduqKQVgjllMuyXaYnRC-pwqk5lnTx3NY2M5Nujo,4320
|
|
104
105
|
tests/package_fixtures.py,sha256=CsJnhB7oYzIxJH7b1tCOPyvnnVSCqEbSPhtCnsHL-nA,5070
|
|
105
106
|
tests/project_fixtures.py,sha256=iBm_th_JtAw76vlNu7Jjhh9tLH4oOaNi-MgtPzCV7yQ,138
|
|
106
|
-
tests/test_api_client.py,sha256=
|
|
107
|
-
tests/test_base_downloader.py,sha256=
|
|
107
|
+
tests/test_api_client.py,sha256=tnYkIYvDILGJRatZM0nrtr83x8yBJstMP0Rt151U2gI,6757
|
|
108
|
+
tests/test_base_downloader.py,sha256=SS7tWKv2ZZhpUDk4UCg1TkrNrpntjSewgzLl1mEubSE,3603
|
|
108
109
|
tests/test_cli.py,sha256=yWWGLip8WgnDAB0vg7uhBU5eeEJieFLQ78Pn7IN-uWI,6088
|
|
109
110
|
tests/test_common.py,sha256=tY_-SY-JmJX09UehFs9RIDqZ785AmhfTl6eVKJeIUFY,763
|
|
110
111
|
tests/test_config.py,sha256=-_G682Ss3Zr1FmcMkjla1zAZprX2tQKpKc5_wD28rII,13340
|
|
@@ -120,8 +121,8 @@ tests/test_uploader.py,sha256=B1llTJt_fqR6e_V_Jxfw9z73QgkFlEPU87xLYGzt-TQ,2914
|
|
|
120
121
|
tests/test_validator.py,sha256=2fY66ayNc08PGyj2vTI-V_1yeCWJDngkj2zkUM5TTCI,1526
|
|
121
122
|
tests/mocks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
122
123
|
tests/mocks/glob.py,sha256=J2MH7nqi6NJOHuGdVWxhfeBd700_Ckj6cLh_8jSNkfg,215
|
|
123
|
-
ciocore-8.0.
|
|
124
|
-
ciocore-8.0.
|
|
125
|
-
ciocore-8.0.
|
|
126
|
-
ciocore-8.0.
|
|
127
|
-
ciocore-8.0.
|
|
124
|
+
ciocore-8.0.0b29.dist-info/METADATA,sha256=RhJwGlupsp9OkYWYYaHTlZXpn_yNBG0stXRyo8KZacA,17850
|
|
125
|
+
ciocore-8.0.0b29.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
|
126
|
+
ciocore-8.0.0b29.dist-info/entry_points.txt,sha256=cCqcALMYbC4d8545V9w0Zysfg9MVuKWhzDQ2er4UfGE,47
|
|
127
|
+
ciocore-8.0.0b29.dist-info/top_level.txt,sha256=SvlM5JlqULzAz00JZWfiUhfjhqDzYzSWssA87zdJl0o,14
|
|
128
|
+
ciocore-8.0.0b29.dist-info/RECORD,,
|
|
@@ -0,0 +1,57 @@
|
|
|
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/test_api_client.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"""
|
|
5
5
|
import sys
|
|
6
6
|
import unittest
|
|
7
|
-
|
|
7
|
+
import json
|
|
8
8
|
try:
|
|
9
9
|
from unittest import mock
|
|
10
10
|
except ImportError:
|
|
@@ -12,6 +12,7 @@ except ImportError:
|
|
|
12
12
|
|
|
13
13
|
from ciocore import api_client
|
|
14
14
|
|
|
15
|
+
from ciocore.api_client import request_extra_environment
|
|
15
16
|
|
|
16
17
|
class ApiClientTest(unittest.TestCase):
|
|
17
18
|
@staticmethod
|
|
@@ -105,3 +106,61 @@ class TestRegisterClient(unittest.TestCase):
|
|
|
105
106
|
|
|
106
107
|
self.assertTrue(user_agent.startswith(expected_user_agent))
|
|
107
108
|
|
|
109
|
+
|
|
110
|
+
class TestRequestExtraEnvironment(unittest.TestCase):
|
|
111
|
+
|
|
112
|
+
def setUp(self):
|
|
113
|
+
self.api_response_data = {
|
|
114
|
+
"data": [
|
|
115
|
+
{"account_id": "123", "env": ["VAR1=value1", "VAR2=value2"]},
|
|
116
|
+
{"account_id": "456", "env": ["VAR3=value3", "VAR4=value4"]}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
self.response_ok = mock.MagicMock(status_code=200, text=json.dumps(self.api_response_data))
|
|
120
|
+
self.response_error = mock.MagicMock(status_code=500, text=json.dumps({"error": "Internal Server Error"}))
|
|
121
|
+
|
|
122
|
+
@mock.patch("ciocore.api_client.ApiClient")
|
|
123
|
+
@mock.patch("ciocore.api_client.read_conductor_credentials")
|
|
124
|
+
@mock.patch("ciocore.api_client.account_id_from_jwt")
|
|
125
|
+
def test_request_extra_environment_success(self, mock_account_id_from_jwt, mock_read_conductor_credentials, mock_ApiClient):
|
|
126
|
+
# Set up mocks for successful execution
|
|
127
|
+
mock_read_conductor_credentials.return_value = "valid_token"
|
|
128
|
+
mock_account_id_from_jwt.return_value = "123"
|
|
129
|
+
mock_api_instance = mock_ApiClient.return_value
|
|
130
|
+
mock_api_instance.make_request.return_value = (self.response_ok.text, self.response_ok.status_code)
|
|
131
|
+
|
|
132
|
+
result = request_extra_environment()
|
|
133
|
+
|
|
134
|
+
self.assertEqual(result, ["VAR1=value1", "VAR2=value2"])
|
|
135
|
+
mock_ApiClient.assert_called_once()
|
|
136
|
+
mock_read_conductor_credentials.assert_called_once_with(True)
|
|
137
|
+
mock_account_id_from_jwt.assert_called_once_with("valid_token")
|
|
138
|
+
|
|
139
|
+
@mock.patch("ciocore.api_client.ApiClient")
|
|
140
|
+
def test_request_extra_environment_api_failure(self, mock_ApiClient):
|
|
141
|
+
# Set up mock for API failure
|
|
142
|
+
mock_api_instance = mock_ApiClient.return_value
|
|
143
|
+
mock_api_instance.make_request.return_value = (self.response_error.text, self.response_error.status_code)
|
|
144
|
+
|
|
145
|
+
# Assert exception raised when the API call fails
|
|
146
|
+
with self.assertRaises(Exception) as context:
|
|
147
|
+
request_extra_environment()
|
|
148
|
+
|
|
149
|
+
self.assertIn('Failed to get extra environment', str(context.exception))
|
|
150
|
+
mock_ApiClient.assert_called_once()
|
|
151
|
+
|
|
152
|
+
@mock.patch("ciocore.api_client.ApiClient")
|
|
153
|
+
@mock.patch("ciocore.api_client.read_conductor_credentials")
|
|
154
|
+
@mock.patch("ciocore.api_client.account_id_from_jwt")
|
|
155
|
+
def test_request_extra_environment_no_account_env(self, mock_account_id_from_jwt, mock_read_conductor_credentials, mock_ApiClient):
|
|
156
|
+
# Set up mocks to simulate valid token and account ID but no matching environment
|
|
157
|
+
mock_read_conductor_credentials.return_value = "valid_token"
|
|
158
|
+
mock_account_id_from_jwt.return_value = "invalid_id" # This won't match any 'account_id' in response
|
|
159
|
+
mock_api_instance = mock_ApiClient.return_value
|
|
160
|
+
mock_api_instance.make_request.return_value = (self.response_ok.text, self.response_ok.status_code)
|
|
161
|
+
|
|
162
|
+
with self.assertRaises(Exception) as context:
|
|
163
|
+
request_extra_environment()
|
|
164
|
+
|
|
165
|
+
self.assertEqual("Error: Could not get account environment!", str(context.exception))
|
|
166
|
+
mock_ApiClient.assert_called_once()
|
tests/test_base_downloader.py
CHANGED
|
@@ -9,11 +9,11 @@ from ciocore.downloader.base_downloader import (
|
|
|
9
9
|
)
|
|
10
10
|
import unittest
|
|
11
11
|
from unittest import mock
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
from ciocore import api_client
|
|
14
|
-
|
|
15
|
-
from unittest.mock import
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
from unittest.mock import patch
|
|
16
|
+
|
|
17
17
|
from concurrent.futures import ThreadPoolExecutor
|
|
18
18
|
|
|
19
19
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|