osducli 0.0.42__tar.gz → 0.0.43__tar.gz

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.
Files changed (122) hide show
  1. {osducli-0.0.42/src/osducli.egg-info → osducli-0.0.43}/PKG-INFO +11 -1
  2. {osducli-0.0.42 → osducli-0.0.43}/README.rst +6 -0
  3. {osducli-0.0.42 → osducli-0.0.43}/pyproject.toml +5 -0
  4. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/__init__.py +1 -1
  5. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/cliclient.py +5 -1
  6. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/storage/add.py +45 -29
  7. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/storage/delete.py +6 -5
  8. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/util/file.py +18 -0
  9. {osducli-0.0.42 → osducli-0.0.43/src/osducli.egg-info}/PKG-INFO +11 -1
  10. {osducli-0.0.42 → osducli-0.0.43}/src/osducli.egg-info/requires.txt +4 -0
  11. {osducli-0.0.42 → osducli-0.0.43}/tests/test_cliclient.py +8 -2
  12. {osducli-0.0.42 → osducli-0.0.43}/LICENSE.md +0 -0
  13. {osducli-0.0.42 → osducli-0.0.43}/setup.cfg +0 -0
  14. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/__main__.py +0 -0
  15. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/auth/__init__.py +0 -0
  16. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/auth/aws_token_credential.py +0 -0
  17. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/auth/credentials.py +0 -0
  18. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/auth/msal_interactive.py +0 -0
  19. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/auth/msal_non_interactive.py +0 -0
  20. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/auth/token_credential.py +0 -0
  21. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/click_cli.py +0 -0
  22. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/__init__.py +0 -0
  23. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/config/__init__.py +0 -0
  24. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/config/consts.py +0 -0
  25. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/config/default.py +0 -0
  26. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/config/info.py +0 -0
  27. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/config/list.py +0 -0
  28. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/config/update.py +0 -0
  29. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/crs/__init__.py +0 -0
  30. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/crs/_const.py +0 -0
  31. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/crs/areas.py +0 -0
  32. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/crs/info.py +0 -0
  33. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/crs/list.py +0 -0
  34. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/crs/summary.py +0 -0
  35. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/crs/transforms.py +0 -0
  36. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/dataload/__init__.py +0 -0
  37. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/dataload/checkrefs.py +0 -0
  38. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/dataload/ingest.py +0 -0
  39. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/dataload/status.py +0 -0
  40. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/dataload/verify.py +0 -0
  41. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/__init__.py +0 -0
  42. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/_const.py +0 -0
  43. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/groups/__init__.py +0 -0
  44. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/groups/add.py +0 -0
  45. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/groups/delete.py +0 -0
  46. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/groups/members.py +0 -0
  47. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/info.py +0 -0
  48. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/members/__init__.py +0 -0
  49. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/members/add.py +0 -0
  50. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/members/groups.py +0 -0
  51. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/members/list.py +0 -0
  52. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/members/remove.py +0 -0
  53. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/entitlements/mygroups.py +0 -0
  54. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/file/__init__.py +0 -0
  55. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/file/_const.py +0 -0
  56. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/file/download.py +0 -0
  57. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/file/info.py +0 -0
  58. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/file/metadata.py +0 -0
  59. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/legal/__init__.py +0 -0
  60. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/legal/_const.py +0 -0
  61. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/legal/add.py +0 -0
  62. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/legal/delete.py +0 -0
  63. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/legal/info.py +0 -0
  64. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/legal/listtags.py +0 -0
  65. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/list/__init__.py +0 -0
  66. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/list/records.py +0 -0
  67. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/schema/__init__.py +0 -0
  68. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/schema/_const.py +0 -0
  69. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/schema/add.py +0 -0
  70. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/schema/get.py +0 -0
  71. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/schema/info.py +0 -0
  72. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/schema/list.py +0 -0
  73. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/search/__init__.py +0 -0
  74. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/search/_const.py +0 -0
  75. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/search/id.py +0 -0
  76. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/search/info.py +0 -0
  77. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/search/kind.py +0 -0
  78. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/search/query.py +0 -0
  79. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/status/__init__.py +0 -0
  80. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/status/status.py +0 -0
  81. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/storage/__init__.py +0 -0
  82. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/storage/_const.py +0 -0
  83. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/storage/get.py +0 -0
  84. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/storage/info.py +0 -0
  85. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/storage/list.py +0 -0
  86. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/storage/versions.py +0 -0
  87. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/unit/__init__.py +0 -0
  88. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/unit/_const.py +0 -0
  89. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/unit/info.py +0 -0
  90. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/unit/list.py +0 -0
  91. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/version/__init__.py +0 -0
  92. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/version/version.py +0 -0
  93. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/wellbore_ddms/__init__.py +0 -0
  94. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/wellbore_ddms/_const.py +0 -0
  95. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/wellbore_ddms/info.py +0 -0
  96. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/wellbore_ddms/well_log/__init__.py +0 -0
  97. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/wellbore_ddms/well_log/data.py +0 -0
  98. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/wellbore_ddms/well_log/record.py +0 -0
  99. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/__init__.py +0 -0
  100. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/_const.py +0 -0
  101. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/get.py +0 -0
  102. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/info.py +0 -0
  103. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/list.py +0 -0
  104. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/register.py +0 -0
  105. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/runs.py +0 -0
  106. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/status.py +0 -0
  107. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/commands/workflow/unregister.py +0 -0
  108. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/config.py +0 -0
  109. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/log.py +0 -0
  110. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/state.py +0 -0
  111. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/util/__init__.py +0 -0
  112. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/util/exceptions.py +0 -0
  113. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/util/prompt.py +0 -0
  114. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/util/pypi.py +0 -0
  115. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/util/service_info.py +0 -0
  116. {osducli-0.0.42 → osducli-0.0.43}/src/osducli/wbddms_client.py +0 -0
  117. {osducli-0.0.42 → osducli-0.0.43}/src/osducli.egg-info/SOURCES.txt +0 -0
  118. {osducli-0.0.42 → osducli-0.0.43}/src/osducli.egg-info/dependency_links.txt +0 -0
  119. {osducli-0.0.42 → osducli-0.0.43}/src/osducli.egg-info/entry_points.txt +0 -0
  120. {osducli-0.0.42 → osducli-0.0.43}/src/osducli.egg-info/top_level.txt +0 -0
  121. {osducli-0.0.42 → osducli-0.0.43}/tests/test_click_cli_state.py +0 -0
  122. {osducli-0.0.42 → osducli-0.0.43}/tests/test_help_text.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: osducli
3
- Version: 0.0.42
3
+ Version: 0.0.43
4
4
  Summary: OSDU command line
5
5
  Author-email: Equinor ASA <mhew@equinor.com>
6
6
  License: Apache-2.0
@@ -26,6 +26,10 @@ Requires-Dist: msal-extensions
26
26
  Requires-Dist: azure-identity
27
27
  Requires-Dist: azure-keyvault
28
28
  Requires-Dist: boto3
29
+ Requires-Dist: google
30
+ Requires-Dist: google-auth
31
+ Requires-Dist: google-auth-oauthlib
32
+ Requires-Dist: google-cloud-storage
29
33
  Provides-Extra: dev
30
34
  Requires-Dist: black; extra == "dev"
31
35
  Requires-Dist: isort; extra == "dev"
@@ -79,6 +83,12 @@ For more information, specify the `-h` flag:
79
83
  Change Log
80
84
  ==========
81
85
 
86
+ 0.0.43
87
+ ------
88
+
89
+ - Fix storage add command
90
+ - Implement storage add batching
91
+
82
92
  0.0.42
83
93
  ------
84
94
 
@@ -35,6 +35,12 @@ For more information, specify the `-h` flag:
35
35
  Change Log
36
36
  ==========
37
37
 
38
+ 0.0.43
39
+ ------
40
+
41
+ - Fix storage add command
42
+ - Implement storage add batching
43
+
38
44
  0.0.42
39
45
  ------
40
46
 
@@ -37,6 +37,11 @@ dependencies = [
37
37
  "azure-keyvault",
38
38
  # AWS specific
39
39
  "boto3",
40
+ # GCP specific
41
+ "google",
42
+ "google-auth",
43
+ "google-auth-oauthlib",
44
+ "google-cloud-storage",
40
45
  ]
41
46
 
42
47
  [project.urls]
@@ -12,4 +12,4 @@
12
12
 
13
13
  """ OSDU command line environment"""
14
14
 
15
- __VERSION__ = "0.0.42"
15
+ __VERSION__ = "0.0.43"
@@ -274,7 +274,11 @@ class CliOsduClient(BaseClient):
274
274
  requests.Response: Response object from the HTTP call
275
275
  """
276
276
  url = self.url_from_config(config_url_key, url_extra_path)
277
- response = self.make_request(method=HttpMethod.DELETE, url=url)
277
+
278
+ # TODO: Fix bug in SDK for DELETE. Workaround is to give bearer_token
279
+ response = self.make_request(method=HttpMethod.DELETE, url=url,
280
+ bearer_token=self.token_refresher.refresh_token())
281
+
278
282
  self.check_status_code(response, ok_status_codes)
279
283
  return response
280
284
 
@@ -15,12 +15,12 @@
15
15
  import json
16
16
 
17
17
  import click
18
+ from osdu_api.model.storage.record import Record
18
19
 
19
20
  from osducli.click_cli import CustomClickCommand, State, command_with_output
20
21
  from osducli.cliclient import CliOsduClient, handle_cli_exceptions
21
- from osducli.config import CONFIG_STORAGE_URL
22
22
  from osducli.log import get_logger
23
- from osducli.util.file import get_files_from_path
23
+ from osducli.util.file import get_files_from_path_with_suffix
24
24
 
25
25
  logger = get_logger(__name__)
26
26
 
@@ -51,41 +51,57 @@ def _click_command(state: State, path: str, batch: int):
51
51
  return add_records(state, path, batch)
52
52
 
53
53
 
54
- def add_records(state: State, path: str, batch: int) -> dict:
54
+ def add_records(state: State, path: str, batch: int = None):
55
55
  """Add or update a record
56
56
 
57
57
  Args:
58
58
  state (State): Global state
59
59
  path (str): Path to a record or records to add.
60
60
  batch (int): Batch size per API call. If None then ingest as is
61
- Returns:
62
- dict: Response from service
63
61
  """
64
- if batch is not None:
65
- raise NotImplementedError("--batch is not supported yet for storage add")
66
-
67
- connection = CliOsduClient(state.config)
62
+ client = CliOsduClient(state.config)
63
+ record_client = client.get_storage_record_client()
68
64
 
69
- files = get_files_from_path(path)
65
+ files = get_files_from_path_with_suffix(path, ".json")
70
66
  logger.debug("Files list: %s", files)
71
67
 
72
- # TODO: Check if loaded file is already an array, or a single file
73
- # TODO: Batch uploads
74
- responses = []
68
+ if batch is not None:
69
+ logger.info("Batching records with size %s", batch)
70
+ file_batches = chunk_list(files, batch)
71
+ for file_batch in file_batches:
72
+ response = add_record_batch(record_client, file_batch)
73
+ handle_response(client, response)
74
+ else:
75
+ response = add_record_batch(record_client, files)
76
+ handle_response(client, response)
77
+
78
+
79
+ def add_record_batch(record_client, files):
80
+ record_list = []
75
81
  for filepath in files:
76
- if filepath.endswith(".json"):
77
- with open(filepath, encoding="utf-8") as file:
78
- storage_object = json.load(file)
79
-
80
- logger.info("Processing file %s.", filepath)
81
- if isinstance(storage_object, list):
82
- payload = storage_object
83
- else:
84
- payload = [storage_object]
85
-
86
- response_json = None
87
- response_json = connection.cli_put_returning_json(
88
- CONFIG_STORAGE_URL, "records", payload, [200, 201]
89
- )
90
- responses.append(response_json)
91
- return responses
82
+ with open(filepath, encoding="utf-8") as file:
83
+ storage_object = json.load(file)
84
+
85
+ logger.info("Processing file %s.", filepath)
86
+ record_list.append(Record.from_dict(storage_object))
87
+
88
+ return record_client.create_update_records(record_list)
89
+
90
+
91
+ def chunk_list(lst, size):
92
+ return [lst[i:i + size] for i in range(0, len(lst), size)]
93
+
94
+
95
+ def handle_response(client, response):
96
+ client.check_status_code(response, [200, 201])
97
+ response_json = response.json()
98
+ count = response_json["recordCount"]
99
+ added = response_json["recordIds"]
100
+ skipped = response_json.get("skippedRecordIds", [])
101
+
102
+ print(f"Record count: {count}")
103
+ print(json.dumps(added, indent=2))
104
+
105
+ if skipped:
106
+ print("Skipped records:")
107
+ print(json.dumps(skipped, indent=2))
@@ -10,13 +10,12 @@
10
10
  # See the License for the specific language governing permissions and
11
11
  # limitations under the License.
12
12
 
13
- """Storage service versions command"""
13
+ """Storage service delete command"""
14
14
 
15
15
  import click
16
16
 
17
17
  from osducli.click_cli import CustomClickCommand, State, global_params
18
18
  from osducli.cliclient import CliOsduClient, handle_cli_exceptions
19
- from osducli.config import CONFIG_STORAGE_URL
20
19
 
21
20
 
22
21
  # click entry point
@@ -36,9 +35,11 @@ def delete(state: State, id: str): # pylint: disable=invalid-name,redefined-bui
36
35
  state (State): Global state
37
36
  id (str): id to delete
38
37
  """
39
- connection = CliOsduClient(state.config)
40
- url = "records/" + id
41
- connection.cli_delete(CONFIG_STORAGE_URL, url, [200, 204])
38
+ client = CliOsduClient(state.config)
39
+ record_client = client.get_storage_record_client()
40
+ # TODO: Fix bug in SDK for DELETE. Workaround is to give bearer_token
41
+ response = record_client.delete_record(recordId=id, bearer_token=client.token_refresher.refresh_token())
42
+ client.check_status_code(response, [200, 204])
42
43
 
43
44
  if state.is_user_friendly_mode():
44
45
  print("1 record deleted")
@@ -12,6 +12,7 @@
12
12
 
13
13
  import errno
14
14
  import os
15
+ import glob
15
16
 
16
17
 
17
18
  def get_files_from_path(path: str) -> list:
@@ -34,6 +35,23 @@ def get_files_from_path(path: str) -> list:
34
35
  return allfiles
35
36
 
36
37
 
38
+ def get_files_from_path_with_suffix(path: str, suffix: str) -> list:
39
+ """Given a path get a list of all files with a certain suffix.
40
+
41
+ Args:
42
+ path (str): path
43
+ suffix (str): file suffix to filter by
44
+
45
+ Returns:
46
+ list: list of file paths
47
+ """
48
+ if os.path.isfile(path):
49
+ return [path] if path.endswith(suffix) else []
50
+
51
+ pattern = os.path.join(path, '**', f'*{suffix}')
52
+ return glob.glob(pattern, recursive=True)
53
+
54
+
37
55
  def ensure_directory_exists(directory: str):
38
56
  """Create a directory if it doesn't exist"""
39
57
  if not os.path.isdir(directory):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: osducli
3
- Version: 0.0.42
3
+ Version: 0.0.43
4
4
  Summary: OSDU command line
5
5
  Author-email: Equinor ASA <mhew@equinor.com>
6
6
  License: Apache-2.0
@@ -26,6 +26,10 @@ Requires-Dist: msal-extensions
26
26
  Requires-Dist: azure-identity
27
27
  Requires-Dist: azure-keyvault
28
28
  Requires-Dist: boto3
29
+ Requires-Dist: google
30
+ Requires-Dist: google-auth
31
+ Requires-Dist: google-auth-oauthlib
32
+ Requires-Dist: google-cloud-storage
29
33
  Provides-Extra: dev
30
34
  Requires-Dist: black; extra == "dev"
31
35
  Requires-Dist: isort; extra == "dev"
@@ -79,6 +83,12 @@ For more information, specify the `-h` flag:
79
83
  Change Log
80
84
  ==========
81
85
 
86
+ 0.0.43
87
+ ------
88
+
89
+ - Fix storage add command
90
+ - Implement storage add batching
91
+
82
92
  0.0.42
83
93
  ------
84
94
 
@@ -9,6 +9,10 @@ msal-extensions
9
9
  azure-identity
10
10
  azure-keyvault
11
11
  boto3
12
+ google
13
+ google-auth
14
+ google-auth-oauthlib
15
+ google-cloud-storage
12
16
 
13
17
  [dev]
14
18
  black
@@ -205,11 +205,14 @@ def test_cli_delete(mocker, cli_client, config, path):
205
205
  response_mock = Mock()
206
206
  response_mock.status_code = 200
207
207
  mock_delete = mocker.patch.object(cli_client, "make_request", return_value=response_mock)
208
+ mock_token_refresher = mocker.Mock()
209
+ mock_token_refresher.refresh_token.return_value = "some-token"
210
+ cli_client.token_refresher = mock_token_refresher
208
211
 
209
212
  response = cli_client.cli_delete(config, path)
210
213
 
211
214
  mock_delete.assert_called_once()
212
- mock_delete.assert_called_with(method=HttpMethod.DELETE, url="https://dummy.com/core_" + config + path)
215
+ mock_delete.assert_called_with(method=HttpMethod.DELETE, url="https://dummy.com/core_" + config + path, bearer_token="some-token")
213
216
  assert response_mock == response
214
217
 
215
218
  @pytest.mark.parametrize("ok_status_codes, actual_status_code",
@@ -224,11 +227,14 @@ def test_cli_delete_status_codes(mocker, cli_client, ok_status_codes, actual_sta
224
227
  response_mock = Mock()
225
228
  response_mock.status_code = actual_status_code
226
229
  mock_delete = mocker.patch.object(cli_client, "make_request", return_value=response_mock)
230
+ mock_token_refresher = mocker.Mock()
231
+ mock_token_refresher.refresh_token.return_value = "some-token"
232
+ cli_client.token_refresher = mock_token_refresher
227
233
 
228
234
  response = cli_client.cli_delete("config", "/path", ok_status_codes)
229
235
 
230
236
  mock_delete.assert_called_once()
231
- mock_delete.assert_called_with(method=HttpMethod.DELETE, url="https://dummy.com/core_config/path")
237
+ mock_delete.assert_called_with(method=HttpMethod.DELETE, url="https://dummy.com/core_config/path", bearer_token="some-token")
232
238
  assert response_mock == response
233
239
 
234
240
  # endregion test cli_delete
File without changes
File without changes
File without changes
File without changes
File without changes