Skip to content

Commit 41b5421

Browse files
committed
ADCM-5587: Rework unittests,test_known_bugs.py file
1 parent 633ab32 commit 41b5421

File tree

11 files changed

+30
-61
lines changed

11 files changed

+30
-61
lines changed

python/api_v2/tests/test_cluster.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def test_create_without_not_required_field_success(self):
178178
self.assertEqual(response.status_code, HTTP_201_CREATED)
179179
self.assertEqual(cluster.description, "")
180180

181-
def test_create_adcm_5371_start_digits_success(self):
181+
def test_adcm_5371_create_start_digits_success(self):
182182
response = (self.client.v2 / "clusters").post(
183183
data={"prototype_id": self.cluster_1.prototype.pk, "name": "1new_test_cluster"}
184184
)
@@ -187,21 +187,21 @@ def test_create_adcm_5371_start_digits_success(self):
187187
self.assertEqual(response.status_code, HTTP_201_CREATED)
188188
self.assertEqual(cluster.description, "")
189189

190-
def test_create_adcm_5371_dot_fail(self):
190+
def test_adcm_5371_create_dot_fail(self):
191191
response = (self.client.v2 / "clusters").post(
192192
data={"prototype_id": self.cluster_1.prototype.pk, "name": "new_test_cluster."}
193193
)
194194

195195
self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST)
196196

197-
def test_create_adcm_5371_space_prohibited_end_start_fail(self):
197+
def test_adcm_5371_create_space_prohibited_end_start_fail(self):
198198
response = (self.client.v2 / "clusters").post(
199199
data={"prototype_id": self.cluster_1.prototype.pk, "name": " new_test_cluster "}
200200
)
201201

202202
self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST)
203203

204-
def test_create_adcm_5371_min_name_2_chars_success(self):
204+
def test_adcm_5371_create_min_name_2_chars_success(self):
205205
response = (self.client.v2 / "clusters").post(data={"prototype_id": self.cluster_1.prototype.pk, "name": "a"})
206206

207207
self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST)
@@ -211,7 +211,7 @@ def test_create_adcm_5371_min_name_2_chars_success(self):
211211
self.assertIsNotNone(Cluster.objects.filter(name="aa").first())
212212
self.assertEqual(response.status_code, HTTP_201_CREATED)
213213

214-
def test_create_adcm_5371_max_name_150_chars_success(self):
214+
def test_adcm_5371_create_max_name_150_chars_success(self):
215215
response = (self.client.v2 / "clusters").post(
216216
data={"prototype_id": self.cluster_1.prototype.pk, "name": "a" * 151}
217217
)

python/api_v2/tests/test_config.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ def test_schema_permissions_another_object_role_denied(self):
188188
response = self.client.v2[self.cluster_1, CONFIG_SCHEMA].get()
189189
self.assertEqual(response.status_code, HTTP_403_FORBIDDEN)
190190

191+
def test_adcm_4778_cluster_variant_bug(self):
192+
# problem is with absent service
193+
bundle = self.add_bundle(self.test_bundles_dir / "bugs" / "ADCM-4778")
194+
cluster = self.add_cluster(bundle, "cooler")
195+
196+
response = self.client.v2[cluster, CONFIG_SCHEMA].get()
197+
self.assertEqual(response.status_code, HTTP_200_OK)
198+
191199
def test_permissions_model_role_list_success(self):
192200
self.client.login(**self.test_user_credentials)
193201
with self.grant_permissions(to=self.test_user, on=[], role_name="View any object configuration"):
@@ -252,16 +260,14 @@ def test_schema_cluster_permissions_another_object_role_denied(self):
252260

253261

254262
class TestSaveConfigWithoutRequiredField(BaseAPITestCase):
255-
"""ADCM-4328"""
256-
257263
def setUp(self) -> None:
258264
super().setUp()
259265

260266
self.service = self.add_services_to_cluster(
261267
service_names=["service_4_save_config_without_required_field"], cluster=self.cluster_1
262268
).get()
263269

264-
def test_save_empty_config_success(self):
270+
def test_adcm_4328_save_empty_config_success(self):
265271
response = self.client.v2[self.service, CONFIGS].post(data={"config": {}, "adcmMeta": {}})
266272
self.assertEqual(response.status_code, HTTP_201_CREATED)
267273

@@ -270,7 +276,7 @@ def test_save_empty_config_success(self):
270276

271277
self.assertDictEqual(current_config, {})
272278

273-
def test_save_config_without_not_required_map_in_group_success(self):
279+
def test_adcm_4328_save_config_without_not_required_map_in_group_success(self):
274280
response = self.client.v2[self.service, CONFIGS].post(
275281
data={
276282
"config": {
@@ -283,7 +289,7 @@ def test_save_config_without_not_required_map_in_group_success(self):
283289
)
284290
self.assertEqual(response.status_code, HTTP_201_CREATED)
285291

286-
def test_default_raw_config_success(self):
292+
def test_adcm_4328_default_raw_config_success(self):
287293
default_config_without_secrets = ConfigLog.objects.get(
288294
obj_ref=self.service.config, id=self.service.config.current
289295
).config

python/api_v2/tests/test_group_config.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ def test_delete_host_success(self):
220220
self.assertEqual(self.host, Host.objects.get(id=self.host.pk))
221221
self.assertNotIn(self.host, self.cluster_1_group_config.hosts.all())
222222

223-
def test_config_description_inheritance(self):
224-
"""ADCM-5199"""
225-
223+
def test_adcm_5199_config_description_inheritance(self):
226224
config_data = {
227225
"config": {
228226
"activatable_group": {"integer": 500},
@@ -525,9 +523,7 @@ def test_host_candidates_success(self):
525523
self.assertEqual(len(response.json()), 1)
526524
self.assertEqual(response.json()[0]["name"], self.host_for_service.name)
527525

528-
def test_config_description_inheritance(self):
529-
"""ADCM-5199"""
530-
526+
def test_adcm_5199_config_description_inheritance(self):
531527
config_data = {
532528
"config": {
533529
"group": {"password": "new_password"},
@@ -761,9 +757,7 @@ def test_delete_host_success(self):
761757
self.assertIn(self.host, self.service_1_group_config.hosts.all())
762758
self.assertNotIn(self.host, self.component_1_group_config.hosts.all())
763759

764-
def test_config_description_inheritance(self):
765-
"""ADCM-5199"""
766-
760+
def test_adcm_5199_config_description_inheritance(self):
767761
config_data = {
768762
"config": {
769763
"group": {"file": "new_content"},
@@ -953,9 +947,7 @@ def test_delete_host_success(self):
953947
self.assertEqual(response.status_code, HTTP_204_NO_CONTENT)
954948
self.assertNotIn(self.host, self.group_config.hosts.all())
955949

956-
def test_config_description_inheritance(self):
957-
"""ADCM-5199"""
958-
950+
def test_adcm_5199_config_description_inheritance(self):
959951
config_data = {
960952
"config": {
961953
"group": {"map": {"integer_key": "99", "string_key": "new_string"}},

python/api_v2/tests/test_known_bugs.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

python/api_v2/tests/test_profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
class TestProfile(BaseAPITestCase):
19-
def test_unauthenticated_access_adcm_4946_fail(self):
19+
def test_adcm_4946_unauthenticated_access_fail(self):
2020
self.client.logout()
2121

2222
path = self.client.v2["profile"].path

python/api_v2/tests/test_tasks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ def test_adcm_5158_adcm_task_view_for_not_superuser_fail(self):
157157
response = (self.client.v2 / "tasks").get()
158158
self.assertNotIn(self.adcm_task.pk, [task["id"] for task in response.json()["results"]])
159159

160-
def test_visibility_after_object_deletion(self):
161-
"""ADCM-4142"""
162-
160+
def test_adcm_4142_visibility_after_object_deletion(self):
163161
cluster_admin_credentials = self.test_user_credentials
164162
cluster_admin = self.test_user
165163
service_admin_credentials = {"username": "service_admin_username", "password": "service_admin_passwo"}

python/api_v2/tests/test_user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def test_permissions_updated_on_group_change_success(self) -> None:
550550
HTTP_200_OK,
551551
)
552552

553-
def test_update_remove_from_groups_bug_adcm_5355(self) -> None:
553+
def test_adcm_5355_update_remove_from_groups_bug(self) -> None:
554554
group_2 = Group.objects.create(name="test_group_2")
555555
user = self.create_user(
556556
user_data={"username": "somebody", "password": "very_long_veryvery", "groups": [{"id": self.group.pk}]}
@@ -764,7 +764,7 @@ def test_filtering_by_type_success(self):
764764
self.assertEqual(len(response.json()["results"]), 1)
765765
self.assertEqual(response.json()["results"][0]["username"], target_user.username)
766766

767-
def test_list_users_when_auth_group_has_no_rbac_group_bug_adcm_5495(self) -> None:
767+
def test_adcm_5495_list_users_when_auth_group_has_no_rbac_group_bug(self) -> None:
768768
user = self.create_user(user_data={"username": "test_user", "password": "test_user_password"})
769769
# In regular usage it's not the case that there are `auth_group` without corresponding `rbac_group`,
770770
# but this bug was originated from such situation.

python/cm/tests/test_hc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_empty_hostcomponent(self):
177177

178178
self.assertEqual(response.status_code, HTTP_200_OK)
179179

180-
def test_run_same_hc_bug_adcm_4929(self) -> None:
180+
def test_adcm_4929_run_same_hc_bug(self) -> None:
181181
bundles_dir = Path(__file__).parent / "bundles"
182182
bundle = self.add_bundle(bundles_dir / "cluster_1")
183183
cluster = self.add_cluster(bundle=bundle, name="Cool")

python/cm/tests/test_inventory/test_action_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def test_action_config(self) -> None:
164164

165165
self.assertDictEqual(job_config, expected_data)
166166

167-
def test_action_config_with_secrets_bug_adcm_5305(self):
167+
def test_adcm_5305_action_config_with_secrets_bug(self):
168168
"""
169169
Actually bug is about `run_action`, because it prepares `config` for task,
170170
but it was caught within `prepare_ansible_job_config` generation, so checked here
@@ -188,7 +188,7 @@ def test_action_config_with_secrets_bug_adcm_5305(self):
188188
self.assertIn("__ansible_vault", job_config["job"]["config"]["rolepass"])
189189
self.assertEqual(ansible_decrypt(job_config["job"]["config"]["rolepass"]["__ansible_vault"]), raw_value)
190190

191-
def test_action_jinja_config_with_secrets_bug_adcm_5314(self):
191+
def test_adcm_5314_action_jinja_config_with_secrets_bug(self):
192192
"""
193193
Actually bug is about `run_action`, because it prepares `config` for task,
194194
but it was caught within `get_job_config` generation, so checked here
@@ -214,7 +214,7 @@ def test_action_jinja_config_with_secrets_bug_adcm_5314(self):
214214
self.assertIn("__ansible_vault", job_config["job"]["config"]["rolepass"])
215215
self.assertEqual(ansible_decrypt(job_config["job"]["config"]["rolepass"]["__ansible_vault"]), raw_value)
216216

217-
def test_action_jinja_config_with_secret_map_and_default_null_password_bug_adcm_5314(self):
217+
def test_adcm_5314_action_jinja_config_with_secret_map_and_default_null_password_bug(self):
218218
"""
219219
Actually bug is about `run_action`, because it prepares `config` for task,
220220
but it was caught within `get_job_config` generation, so checked here

python/cm/tests/test_inventory/test_before_upgrade.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def test_group_config_effect_on_before_upgrade(self) -> None:
419419
expected_data=expected_data,
420420
)
421421

422-
def test_bug_adcm_5367(self) -> None:
422+
def test_adcm_5367_bug(self) -> None:
423423
another_1 = self.add_services_to_cluster(
424424
service_names=["another_service_two_components"], cluster=self.cluster_1
425425
).first()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy