codemie-test-harness 0.1.145__py3-none-any.whl → 0.1.146__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 codemie-test-harness might be problematic. Click here for more details.

@@ -33,6 +33,7 @@ from codemie_test_harness.tests.utils.aws_parameters_store import CredentialsUti
33
33
  from codemie_test_harness.tests.utils.base_utils import get_random_name, wait_for_entity
34
34
  from codemie_test_harness.tests.utils.client_factory import get_client
35
35
  from codemie_test_harness.tests.utils.constants import TESTS_PATH
36
+ from codemie_test_harness.tests.utils.conversation_utils import ConversationUtils
36
37
  from codemie_test_harness.tests.utils.datasource_utils import DataSourceUtils
37
38
  from codemie_test_harness.tests.utils.gitbud_utils import GitBudUtils
38
39
  from codemie_test_harness.tests.utils.integration_utils import IntegrationUtils
@@ -232,6 +233,11 @@ def llm_utils(client):
232
233
  return LLMUtils(client)
233
234
 
234
235
 
236
+ @pytest.fixture(scope="session")
237
+ def conversation_utils(client):
238
+ return ConversationUtils(client)
239
+
240
+
235
241
  @pytest.fixture(scope="function")
236
242
  def git_integration(integration_utils):
237
243
  integration = integration_utils.create_integration(
@@ -465,7 +471,7 @@ def kb_context():
465
471
 
466
472
 
467
473
  @pytest.fixture(scope="function")
468
- def assistant(default_llm, assistant_utils):
474
+ def assistant(default_llm, assistant_utils, conversation_utils):
469
475
  """Create assistant"""
470
476
  created_assistant = None
471
477
 
@@ -511,6 +517,11 @@ def assistant(default_llm, assistant_utils):
511
517
  yield _create_assistant
512
518
  if created_assistant:
513
519
  assistant_utils.delete_assistant(created_assistant)
520
+ conversations = conversation_utils.get_conversation_by_assistant_id(
521
+ created_assistant["id"]
522
+ )
523
+ for conversation in conversations:
524
+ conversation_utils.delete_conversation(conversation.id)
514
525
 
515
526
 
516
527
  @pytest.fixture(scope="function")
@@ -860,6 +871,10 @@ def pytest_sessionfinish(session):
860
871
  if prefix in assistant.name:
861
872
  client.assistants.delete(assistant_id=assistant.id)
862
873
  sleep(clean_up_timeout)
874
+ conversations = client.conversations.list_by_assistant_id(assistant.id)
875
+ for conversation in conversations:
876
+ client.conversations.delete(conversation.id)
877
+ sleep(clean_up_timeout)
863
878
  workflows = client.workflows.list(
864
879
  filters={"name": autotest_entity_prefix}, per_page=200
865
880
  )
File without changes
@@ -0,0 +1,123 @@
1
+ import pytest
2
+ from codemie_sdk.models.conversation import Conversation, ConversationDetails
3
+ from hamcrest import (
4
+ assert_that,
5
+ has_length,
6
+ instance_of,
7
+ all_of,
8
+ has_property,
9
+ greater_than_or_equal_to,
10
+ has_item,
11
+ equal_to,
12
+ has_entry,
13
+ )
14
+
15
+ from codemie_test_harness.tests.utils.base_utils import get_random_name
16
+
17
+
18
+ @pytest.mark.regression
19
+ def test_list_conversations(assistant, assistant_utils, conversation_utils):
20
+ assistant = assistant()
21
+ assistant_utils.ask_assistant(assistant, f"prompt {get_random_name()}")
22
+
23
+ conversations = conversation_utils.list_conversations()
24
+
25
+ assert_that(conversations, instance_of(list))
26
+ assert_that(conversations, has_length(greater_than_or_equal_to(1)))
27
+
28
+ conversation = conversations[0]
29
+ assert_that(
30
+ conversation,
31
+ all_of(
32
+ instance_of(Conversation),
33
+ has_property("id"),
34
+ has_property("name"),
35
+ has_property("folder"),
36
+ has_property("pinned"),
37
+ has_property("date"),
38
+ has_property("assistant_ids", instance_of(list)),
39
+ has_property("initial_assistant_id"),
40
+ ),
41
+ )
42
+
43
+
44
+ @pytest.mark.regression
45
+ def test_get_specific_conversation(assistant, assistant_utils, conversation_utils):
46
+ prompt = f"prompt {get_random_name()}"
47
+ assistant = assistant()
48
+
49
+ assistant_utils.ask_assistant(assistant, prompt)
50
+
51
+ conversations = conversation_utils.list_conversations()
52
+
53
+ first_conversation = conversations[0]
54
+ conversation = conversation_utils.get_conversation_by_id(first_conversation.id)
55
+ assert_that(
56
+ conversation,
57
+ all_of(
58
+ instance_of(ConversationDetails),
59
+ has_property("id", first_conversation.id),
60
+ has_property("conversation_name", prompt),
61
+ has_property("initial_assistant_id", assistant.id),
62
+ ),
63
+ )
64
+
65
+
66
+ @pytest.mark.regression
67
+ def test_get_conversation_by_assistant_id(
68
+ assistant, assistant_utils, conversation_utils
69
+ ):
70
+ prompt = f"prompt {get_random_name()}"
71
+ assistant = assistant()
72
+
73
+ assistant_utils.ask_assistant(assistant, prompt)
74
+ conversation = conversation_utils.get_conversation_by_assistant_id(assistant.id)
75
+ assert_that(
76
+ conversation[0],
77
+ all_of(
78
+ instance_of(Conversation),
79
+ has_property("id", conversation[0].id),
80
+ has_property("name", prompt),
81
+ has_property("assistant_ids", has_item(assistant.id)),
82
+ has_property("initial_assistant_id", assistant.id),
83
+ ),
84
+ )
85
+
86
+
87
+ @pytest.mark.regression
88
+ def test_delete_conversation(assistant, assistant_utils, conversation_utils):
89
+ prompt = f"prompt {get_random_name()}"
90
+ assistant = assistant()
91
+
92
+ assistant_utils.ask_assistant(assistant, prompt)
93
+ conversation = conversation_utils.get_conversation_by_assistant_id(assistant.id)
94
+
95
+ delete_response = conversation_utils.delete_conversation(conversation[0].id)
96
+ assert_that(
97
+ delete_response["message"],
98
+ equal_to("Specified conversation removed"),
99
+ "Conversation delete response is not as expected.",
100
+ )
101
+
102
+
103
+ @pytest.mark.regression
104
+ def test_get_non_existent_conversation(assistant, assistant_utils, conversation_utils):
105
+ invalid_id = get_random_name()
106
+ with pytest.raises(Exception) as exc_info:
107
+ conversation_utils.get_conversation_by_id(invalid_id)
108
+
109
+ error_response = exc_info.value.response.json()
110
+ assert_that(
111
+ error_response["error"],
112
+ all_of(
113
+ has_entry("message", "Conversation not found"),
114
+ has_entry(
115
+ "details",
116
+ f"The conversation with ID [{invalid_id}] could not be found in the system.",
117
+ ),
118
+ has_entry(
119
+ "help",
120
+ "Please verify the conversation ID and try again. If you believe this is an error, contact support.",
121
+ ),
122
+ ),
123
+ )
@@ -0,0 +1,17 @@
1
+ import requests
2
+
3
+ from codemie_test_harness.tests.utils.base_utils import BaseUtils
4
+
5
+
6
+ class ConversationUtils(BaseUtils):
7
+ def list_conversations(self):
8
+ return self.client.conversations.list()
9
+
10
+ def get_conversation_by_assistant_id(self, assistant_id: str):
11
+ return self.client.conversations.list_by_assistant_id(assistant_id)
12
+
13
+ def get_conversation_by_id(self, conversation_id: str) -> requests.Response:
14
+ return self.client.conversations.get_conversation(conversation_id)
15
+
16
+ def delete_conversation(self, conversation_id: str) -> requests.Response:
17
+ return self.client.conversations.delete(conversation_id)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: codemie-test-harness
3
- Version: 0.1.145
3
+ Version: 0.1.146
4
4
  Summary: Autotest for CodeMie backend and UI
5
5
  Author: Anton Yeromin
6
6
  Author-email: anton_yeromin@epam.com
@@ -13,7 +13,7 @@ Requires-Dist: aws-assume-role-lib (>=2.10.0,<3.0.0)
13
13
  Requires-Dist: boto3 (>=1.39.8,<2.0.0)
14
14
  Requires-Dist: click (>=8.1.7,<9.0.0)
15
15
  Requires-Dist: codemie-plugins (>=0.1.123,<0.2.0)
16
- Requires-Dist: codemie-sdk-python (==0.1.145)
16
+ Requires-Dist: codemie-sdk-python (==0.1.146)
17
17
  Requires-Dist: pytest (>=8.4.1,<9.0.0)
18
18
  Requires-Dist: pytest-playwright (>=0.7.0,<0.8.0)
19
19
  Requires-Dist: pytest-reportportal (>=5.5.2,<6.0.0)
@@ -55,7 +55,9 @@ codemie_test_harness/tests/assistant/tools/servicenow/__init__.py,sha256=47DEQpj
55
55
  codemie_test_harness/tests/assistant/tools/servicenow/test_servicenow_tools.py,sha256=JV_n6COaCsd0_rxQBJvvLZfPdo8BsCbG8Ti-UpzFvfQ,644
56
56
  codemie_test_harness/tests/assistant/tools/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  codemie_test_harness/tests/assistant/tools/vcs/test_assistant_with_vcs_tools.py,sha256=5-QybLWmYSqHG4Sqr-IN-vNcStV4skSwCJQN44Nfats,922
58
- codemie_test_harness/tests/conftest.py,sha256=qzKtJdd7j0I6jBiIOCnz1uF0-Qm0wLWkSwXK_Rg3adI,27869
58
+ codemie_test_harness/tests/conftest.py,sha256=pS_7Zh2QLUMgC2wepEFx-ut1-UzOGZy_WIn9rb7z2D4,28557
59
+ codemie_test_harness/tests/conversations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
+ codemie_test_harness/tests/conversations/test_conversations_endpoints.py,sha256=SQraRVrjjE4mYTs4EuGzMrO96DuOuKTiYQ4ZRBhHx70,3913
59
61
  codemie_test_harness/tests/e2e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
62
  codemie_test_harness/tests/e2e/test_e2e.py,sha256=RUvSu_uNInU1OFfkNft3-Cmd0KZV7JdHqCxSK2ZWXHw,6257
61
63
  codemie_test_harness/tests/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -213,6 +215,7 @@ codemie_test_harness/tests/utils/aws_parameters_store.py,sha256=uwhvrk4qYYWLILS0
213
215
  codemie_test_harness/tests/utils/base_utils.py,sha256=tfishCUxO3iEuasWOifoF9_fXspm4uIHS26Ryqu-NxA,5998
214
216
  codemie_test_harness/tests/utils/client_factory.py,sha256=Yyg2iXe7g7fIfIUbOH8z_8qgVo_lB-nYLOfCV5ONXFw,641
215
217
  codemie_test_harness/tests/utils/constants.py,sha256=lb6mgLjt0GM85Khs18rL1jnE9ILx8L811ykNhpF6IDA,1111
218
+ codemie_test_harness/tests/utils/conversation_utils.py,sha256=SWj6TBWOQoX5Yh6Wk63yHQFveRXgK1mpLb3PUKAa57A,648
216
219
  codemie_test_harness/tests/utils/datasource_utils.py,sha256=-_HZfW_UufSUVkSUCVq4jMlq9MCcKtMhzD6iBtadzmk,12502
217
220
  codemie_test_harness/tests/utils/file_utils.py,sha256=hY-kwnyzvtd1BQif8r5NhvRTGfpKLmQKyRsq1Tuflhg,585
218
221
  codemie_test_harness/tests/utils/gitbud_utils.py,sha256=UJ3RbhPSjHQSdos6S6zTR9iZULrBDJXoXq9cbjFH7bo,7829
@@ -323,7 +326,7 @@ codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/__init__.
323
326
  codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/test_workflow_with_servicenow_tools.py,sha256=Cxe5Yuy9JE_IEsnQOThpVIZQqpfLuHfDkF6JwLngDc8,890
324
327
  codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
325
328
  codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/test_workflow_with_vcs_tools.py,sha256=tm0NvUf_UtzLPTYJWykYpsNoxoVs-Eh80guDmRwImwg,1106
326
- codemie_test_harness-0.1.145.dist-info/METADATA,sha256=51dlZOgpU6_HjYSp6gV5MiLCqZ-5ZoxhwBUgTL3Bgfg,8998
327
- codemie_test_harness-0.1.145.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
328
- codemie_test_harness-0.1.145.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
329
- codemie_test_harness-0.1.145.dist-info/RECORD,,
329
+ codemie_test_harness-0.1.146.dist-info/METADATA,sha256=C9bfCCtoQp9HHKSUzlo4GdgfZpMtU1OQPG_yf7GHQxs,8998
330
+ codemie_test_harness-0.1.146.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
331
+ codemie_test_harness-0.1.146.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
332
+ codemie_test_harness-0.1.146.dist-info/RECORD,,