orangebeard-client 2.2.0__tar.gz → 2.3.0__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 (33) hide show
  1. {orangebeard_client-2.2.0/orangebeard_client.egg-info → orangebeard_client-2.3.0}/PKG-INFO +1 -1
  2. orangebeard_client-2.3.0/orangebeard/Cli.py +57 -0
  3. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/OrangebeardClient.py +41 -13
  4. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/config/AutoConfig.py +1 -0
  5. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/OrangebeardParameters.py +3 -1
  6. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0/orangebeard_client.egg-info}/PKG-INFO +1 -1
  7. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard_client.egg-info/SOURCES.txt +2 -0
  8. orangebeard_client-2.3.0/orangebeard_client.egg-info/entry_points.txt +2 -0
  9. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/pyproject.toml +4 -1
  10. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/LICENSE +0 -0
  11. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/__init__.py +0 -0
  12. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/Attachment.py +0 -0
  13. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/Attribute.py +0 -0
  14. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/FinishStep.py +0 -0
  15. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/FinishTest.py +0 -0
  16. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/FinishTestRun.py +0 -0
  17. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/Log.py +0 -0
  18. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/LogFormat.py +0 -0
  19. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/LogLevel.py +0 -0
  20. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/SUTComponent.py +0 -0
  21. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/Serializable.py +0 -0
  22. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/StartStep.py +0 -0
  23. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/StartSuite.py +0 -0
  24. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/StartTest.py +0 -0
  25. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/StartTestRun.py +0 -0
  26. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/Suite.py +0 -0
  27. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/TestStatus.py +0 -0
  28. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/TestType.py +0 -0
  29. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard/entity/__init__.py +0 -0
  30. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard_client.egg-info/dependency_links.txt +0 -0
  31. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard_client.egg-info/requires.txt +0 -0
  32. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/orangebeard_client.egg-info/top_level.txt +0 -0
  33. {orangebeard_client-2.2.0 → orangebeard_client-2.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: orangebeard-client
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: A python3 client for Orangebeard
5
5
  Author-email: Tom Heintzberger <tom@orangebeard.io>
6
6
  Project-URL: Homepage, https://github.com/orangebeard-io/python-client
@@ -0,0 +1,57 @@
1
+ import argparse
2
+ import asyncio
3
+ import sys
4
+
5
+ from datetime import datetime
6
+
7
+ from orangebeard.OrangebeardClient import OrangebeardClient
8
+ from orangebeard.config import AutoConfig
9
+ from orangebeard.entity.FinishTestRun import FinishTestRun
10
+ from orangebeard.entity.StartTestRun import StartTestRun
11
+ from pytz import reference
12
+
13
+ tz = reference.LocalTimezone()
14
+
15
+
16
+ def main():
17
+ config = AutoConfig.config
18
+
19
+ parser = argparse.ArgumentParser(prog="Orangebeard CommandLine Utility",
20
+ description="CLI to start or finish a test run")
21
+ parser.add_argument('-e', '--endpoint', help="Your Orangebeard endpoint", default=config.endpoint)
22
+ parser.add_argument('-t', '--accessToken', help="Your Orangebeard Access Token", default=config.token)
23
+ parser.add_argument('-p', '--project', help="Orangebeard Project Name", default=config.project)
24
+ parser.add_argument('-x', '--cmd', required=True, choices=['start', 'finish'], help="Command to execute")
25
+ parser.add_argument('-s', '--testset', help="The testset name, required for start command", default=config.testset)
26
+ parser.add_argument('-d', '--description', help="The test run description", default=config.description)
27
+ parser.add_argument('-id', '--testRunUuid', help="The UUID of the test run to finish, required for finish",
28
+ default=None)
29
+
30
+ args = parser.parse_args()
31
+
32
+ config.endpoint = args.endpoint
33
+ config.token = args.accessToken
34
+ config.project = args.project
35
+ config.test_set = args.testset
36
+ config.description = args.description
37
+
38
+ client = OrangebeardClient(orangebeard_config=config)
39
+
40
+ if args.cmd == "start":
41
+ temp_uuid = client.start_test_run(StartTestRun(config.testset, datetime.now(tz), config.description), True)
42
+ asyncio.gather(client.call_events[temp_uuid].wait())
43
+ print(client.uuid_mapping[temp_uuid])
44
+ sys.exit(0)
45
+
46
+ else:
47
+ if args.cmd == "finish" and args.testRunUuid is not None:
48
+ client.finish_test_run(args.testRunUuid, FinishTestRun(datetime.now(tz)), True)
49
+ print('Orangebeard report Finished!')
50
+ sys.exit(0)
51
+
52
+ parser.print_help()
53
+ sys.exit(1)
54
+
55
+
56
+ if __name__ == '__main__':
57
+ main()
@@ -70,6 +70,7 @@ class OrangebeardClient:
70
70
  access_token = config.token
71
71
  project_name = config.project
72
72
 
73
+ self.__external_run_lifecycle = False
73
74
  self.__endpoint = endpoint
74
75
  self.__access_token = access_token
75
76
  self.__project_name = project_name
@@ -81,14 +82,21 @@ class OrangebeardClient:
81
82
  self.__event_loop = asyncio.new_event_loop()
82
83
  asyncio.set_event_loop(self.__event_loop)
83
84
 
85
+ if orangebeard_config.testrun_uuid is not None:
86
+ print('external lifecycle!')
87
+ self.__external_run_lifecycle = True
88
+ self.__call_events[orangebeard_config.testrun_uuid] = asyncio.Event()
89
+ self.__uuid_mapping[orangebeard_config.testrun_uuid] = orangebeard_config.testrun_uuid
90
+ self.__call_events[orangebeard_config.testrun_uuid].set()
84
91
 
85
92
 
86
- def start_test_run(self, start_test_run: StartTestRun) -> UUID:
93
+ def start_test_run(self, start_test_run: StartTestRun, direct=False) -> UUID:
87
94
  """
88
95
  Start a new test run.
89
96
 
90
97
  Args:
91
98
  start_test_run (StartTestRun): The StartTestRun object containing information about the test run.
99
+ direct: boolean indicating a standalone, direct cli call
92
100
 
93
101
  Returns:
94
102
  UUID: The UUID associated with the started test run.
@@ -98,7 +106,7 @@ class OrangebeardClient:
98
106
 
99
107
  self.__call_events[temp_uuid] = start_test_run_event
100
108
 
101
- self.__event_loop.run_until_complete(self.__exec_start_test_run(start_test_run, temp_uuid))
109
+ self.__event_loop.run_until_complete(self.__exec_start_test_run(start_test_run, temp_uuid, direct))
102
110
  return temp_uuid
103
111
 
104
112
  def start_announced_test_run(self, test_run_uuid: UUID) -> None:
@@ -112,7 +120,7 @@ class OrangebeardClient:
112
120
  self.__call_events[test_run_uuid] = start_test_run_event
113
121
  self.__event_loop.run_until_complete(self.__exec_start_announced_test_run(test_run_uuid))
114
122
 
115
- def finish_test_run(self, test_run_uuid: UUID, finish_test_run: FinishTestRun) -> None:
123
+ def finish_test_run(self, test_run_uuid: UUID, finish_test_run: FinishTestRun, direct=False) -> None:
116
124
  """
117
125
  Wait for all events to finish and then finish the test run.
118
126
 
@@ -120,9 +128,10 @@ class OrangebeardClient:
120
128
  test_run_uuid (UUID): The UUID of the test run to be finished.
121
129
  finish_test_run (FinishTestRun): The FinishTestRun object containing information about finishing the
122
130
  test run.
131
+ direct (Bool): indication that a standalone finish call is required. True for CLI
123
132
  """
124
133
  self.__event_loop.run_until_complete(
125
- self.__exec_finish_test_run(test_run_uuid, finish_test_run))
134
+ self.__exec_finish_test_run(test_run_uuid, finish_test_run, direct))
126
135
 
127
136
  def start_suite(self, start_suite: StartSuite) -> list[UUID]:
128
137
  """
@@ -285,7 +294,7 @@ class OrangebeardClient:
285
294
  self.__connection_with_orangebeard_is_valid = False
286
295
  raise ConnectionError(f'Failed to communicate with Orangebeard after {retry_count} attempts')
287
296
 
288
- async def __exec_start_test_run(self, start_test_run: StartTestRun, temp_uuid: UUID) -> None:
297
+ async def __exec_start_test_run(self, start_test_run: StartTestRun, temp_uuid: UUID, direct=False) -> None:
289
298
  response = await self.__make_api_request(
290
299
  'POST',
291
300
  f'/listener/v3/{self.__project_name}/test-run/start',
@@ -295,6 +304,9 @@ class OrangebeardClient:
295
304
  self.__uuid_mapping[temp_uuid] = actual_uuid
296
305
  self.__call_events[temp_uuid].set()
297
306
 
307
+ if direct is True:
308
+ await self.__client.close()
309
+
298
310
  async def __exec_start_announced_test_run(self, test_run_uuid: UUID) -> None:
299
311
  await self.__make_api_request(
300
312
  'PUT',
@@ -303,19 +315,27 @@ class OrangebeardClient:
303
315
  self.__uuid_mapping[test_run_uuid] = test_run_uuid
304
316
  self.__call_events[test_run_uuid].set()
305
317
 
306
- async def __exec_finish_test_run(self, test_run_uuid: UUID, finish_test_run: FinishTestRun) -> None:
318
+ async def __exec_finish_test_run(self, test_run_uuid: UUID, finish_test_run: FinishTestRun, direct=False) -> None:
307
319
  print(f'Waiting for {len(self.__call_events.values()) + 1} Orangebeard events to finish...')
308
320
 
309
321
  for event in self.__call_events.values():
310
322
  await event.wait()
311
323
 
312
- real_test_run_uuid = self.__uuid_mapping[test_run_uuid]
313
- await self.__make_api_request(
314
- 'PUT',
315
- f'/listener/v3/{self.__project_name}/test-run/finish/{real_test_run_uuid}',
316
- finish_test_run
317
- )
318
- print('Done. Test run finished!')
324
+ if direct is True:
325
+ real_test_run_uuid = test_run_uuid
326
+ else:
327
+ real_test_run_uuid = self.__uuid_mapping[test_run_uuid]
328
+
329
+ if self.__external_run_lifecycle is False:
330
+ await self.__make_api_request(
331
+ 'PUT',
332
+ f'/listener/v3/{self.__project_name}/test-run/finish/{real_test_run_uuid}',
333
+ finish_test_run
334
+ )
335
+ print('Done. Test run finished!')
336
+ else:
337
+ print('Ended run without sending test run finish call. Remember to finish using CLI!')
338
+
319
339
  await self.__client.close()
320
340
 
321
341
  async def __exec_start_suite(self, start_suite: StartSuite, suite_temp_ids: list[UUID],
@@ -453,3 +473,11 @@ class OrangebeardClient:
453
473
  else:
454
474
  self.__connection_with_orangebeard_is_valid = False
455
475
  raise ConnectionError(f'Failed to communicate with Orangebeard: {await response.text()}')
476
+
477
+ @property
478
+ def call_events(self):
479
+ return self.__call_events
480
+
481
+ @property
482
+ def uuid_mapping(self):
483
+ return self.__uuid_mapping
@@ -21,6 +21,7 @@ def update_config_parameters_from_env(current_config: OrangebeardParameters) ->
21
21
  os.environ.get('ORANGEBEARD_ATTRIBUTES', '')) if os.environ.get(
22
22
  'ORANGEBEARD_ATTRIBUTES') else current_config.attributes
23
23
  current_config.ref_url = os.environ.get('ORANGEBEARD_REF_URL', current_config.ref_url)
24
+ current_config.testrun_uuid = os.environ.get('ORANGEBEARD_TESTRUN_UUID', current_config.testrun_uuid)
24
25
 
25
26
  return current_config
26
27
 
@@ -9,7 +9,8 @@ class OrangebeardParameters(Serializable):
9
9
  project=None,
10
10
  description=None,
11
11
  attributes=None,
12
- ref_url=None
12
+ ref_url=None,
13
+ testrun_uuid=None
13
14
  ):
14
15
  self.token = token
15
16
  self.endpoint = endpoint
@@ -18,3 +19,4 @@ class OrangebeardParameters(Serializable):
18
19
  self.description = description
19
20
  self.attributes = attributes
20
21
  self.ref_url = ref_url
22
+ self.testrun_uuid = testrun_uuid
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: orangebeard-client
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: A python3 client for Orangebeard
5
5
  Author-email: Tom Heintzberger <tom@orangebeard.io>
6
6
  Project-URL: Homepage, https://github.com/orangebeard-io/python-client
@@ -1,5 +1,6 @@
1
1
  LICENSE
2
2
  pyproject.toml
3
+ orangebeard/Cli.py
3
4
  orangebeard/OrangebeardClient.py
4
5
  orangebeard/__init__.py
5
6
  orangebeard/config/AutoConfig.py
@@ -25,5 +26,6 @@ orangebeard/entity/__init__.py
25
26
  orangebeard_client.egg-info/PKG-INFO
26
27
  orangebeard_client.egg-info/SOURCES.txt
27
28
  orangebeard_client.egg-info/dependency_links.txt
29
+ orangebeard_client.egg-info/entry_points.txt
28
30
  orangebeard_client.egg-info/requires.txt
29
31
  orangebeard_client.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ orangebeard-cli = orangebeard.Cli:main
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "orangebeard-client"
7
- version = "2.2.0"
7
+ version = "2.3.0"
8
8
  description = "A python3 client for Orangebeard"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -14,6 +14,9 @@ dependencies = [ "pytz", "aiohttp",]
14
14
  name = "Tom Heintzberger"
15
15
  email = "tom@orangebeard.io"
16
16
 
17
+ [project.scripts]
18
+ orangebeard-cli = "orangebeard.Cli:main"
19
+
17
20
  [project.urls]
18
21
  Homepage = "https://github.com/orangebeard-io/python-client"
19
22
  "Bug Tracker" = "https://github.com/orangebeard-io/python-client/issues"