cactus-test-definitions 1.6.0__py3-none-any.whl → 1.8.1__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 cactus-test-definitions might be problematic. Click here for more details.

Files changed (74) hide show
  1. cactus_test_definitions/__init__.py +1 -1
  2. cactus_test_definitions/__pycache__/__init__.cpython-312.pyc +0 -0
  3. cactus_test_definitions/__pycache__/csipaus.cpython-312.pyc +0 -0
  4. cactus_test_definitions/client/__init__.py +4 -0
  5. cactus_test_definitions/client/__pycache__/__init__.cpython-312.pyc +0 -0
  6. cactus_test_definitions/client/__pycache__/actions.cpython-312.pyc +0 -0
  7. cactus_test_definitions/client/__pycache__/checks.cpython-312.pyc +0 -0
  8. cactus_test_definitions/client/actions.py +1 -0
  9. cactus_test_definitions/client/checks.py +1 -0
  10. cactus_test_definitions/client/procedures/ALL-09.yaml +18 -18
  11. cactus_test_definitions/client/procedures/ALL-12.yaml +34 -16
  12. cactus_test_definitions/client/procedures/ALL-18.yaml +6 -5
  13. cactus_test_definitions/client/procedures/ALL-28.yaml +0 -1
  14. cactus_test_definitions/client/procedures/GEN-10.yaml +58 -4
  15. cactus_test_definitions/client/procedures/GEN-11.yaml +32 -8
  16. cactus_test_definitions/client/procedures/GEN-12.yaml +33 -9
  17. cactus_test_definitions/client/procedures/LOA-03.yaml +1 -1
  18. cactus_test_definitions/client/procedures/LOA-04.yaml +1 -1
  19. cactus_test_definitions/client/procedures/LOA-10.yaml +61 -9
  20. cactus_test_definitions/client/procedures/LOA-11.yaml +32 -8
  21. cactus_test_definitions/client/procedures/LOA-12.yaml +32 -8
  22. cactus_test_definitions/csipaus.py +2 -0
  23. cactus_test_definitions/server/README.md +8 -6
  24. cactus_test_definitions/server/__init__.py +4 -0
  25. cactus_test_definitions/server/__pycache__/__init__.cpython-312.pyc +0 -0
  26. cactus_test_definitions/server/__pycache__/actions.cpython-312.pyc +0 -0
  27. cactus_test_definitions/server/__pycache__/checks.cpython-312.pyc +0 -0
  28. cactus_test_definitions/server/__pycache__/test_procedures.cpython-312-pytest-8.3.5.pyc +0 -0
  29. cactus_test_definitions/server/actions.py +2 -1
  30. cactus_test_definitions/server/checks.py +35 -0
  31. cactus_test_definitions/server/procedures/S-ALL-01.yaml +3 -0
  32. cactus_test_definitions/server/procedures/S-ALL-06.yaml +111 -0
  33. cactus_test_definitions/server/procedures/S-ALL-07.yaml +100 -0
  34. cactus_test_definitions/server/procedures/S-ALL-08.yaml +77 -0
  35. cactus_test_definitions/server/procedures/S-ALL-09.yaml +43 -0
  36. cactus_test_definitions/server/procedures/S-ALL-10.yaml +68 -0
  37. cactus_test_definitions/server/procedures/S-ALL-11.yaml +36 -0
  38. cactus_test_definitions/server/procedures/S-ALL-12.yaml +36 -0
  39. cactus_test_definitions/server/procedures/S-ALL-13.yaml +36 -0
  40. cactus_test_definitions/server/procedures/S-ALL-14.yaml +36 -0
  41. cactus_test_definitions/server/procedures/S-ALL-15.yaml +79 -0
  42. cactus_test_definitions/server/procedures/S-ALL-16.yaml +79 -0
  43. cactus_test_definitions/server/procedures/S-ALL-17.yaml +39 -0
  44. cactus_test_definitions/server/procedures/S-ALL-18.yaml +35 -0
  45. cactus_test_definitions/server/procedures/S-ALL-19.yaml +34 -0
  46. cactus_test_definitions/server/procedures/S-ALL-20.yaml +34 -0
  47. cactus_test_definitions/server/procedures/S-ALL-21.yaml +34 -0
  48. cactus_test_definitions/server/procedures/S-ALL-22.yaml +34 -0
  49. cactus_test_definitions/server/procedures/S-ALL-23.yaml +34 -0
  50. cactus_test_definitions/server/procedures/S-ALL-24.yaml +37 -0
  51. cactus_test_definitions/server/procedures/S-ALL-25.yaml +151 -0
  52. cactus_test_definitions/server/procedures/S-ALL-41.yaml +343 -0
  53. cactus_test_definitions/server/procedures/S-ALL-42.yaml +81 -0
  54. cactus_test_definitions/server/procedures/S-ALL-43.yaml +146 -0
  55. cactus_test_definitions/server/procedures/S-ALL-44.yaml +51 -0
  56. cactus_test_definitions/server/procedures/S-ALL-45.yaml +34 -0
  57. cactus_test_definitions/server/procedures/S-ALL-48.yaml +29 -0
  58. cactus_test_definitions/server/procedures/S-ALL-49.yaml +56 -0
  59. cactus_test_definitions/server/procedures/S-ALL-51.yaml +35 -0
  60. cactus_test_definitions/server/procedures/S-ALL-52.yaml +35 -0
  61. cactus_test_definitions/server/procedures/S-ALL-53.yaml +42 -0
  62. cactus_test_definitions/server/procedures/S-ALL-55.yaml +45 -0
  63. cactus_test_definitions/server/procedures/S-ALL-56.yaml +36 -0
  64. cactus_test_definitions/server/procedures/S-ALL-57.yaml +62 -0
  65. cactus_test_definitions/server/procedures/S-OPT-03.yaml +9 -6
  66. cactus_test_definitions/server/procedures/S-OPT-05.yaml +33 -0
  67. cactus_test_definitions/server/test_procedures.py +34 -0
  68. {cactus_test_definitions-1.6.0.dist-info → cactus_test_definitions-1.8.1.dist-info}/METADATA +1 -1
  69. {cactus_test_definitions-1.6.0.dist-info → cactus_test_definitions-1.8.1.dist-info}/RECORD +74 -40
  70. tests/unit/client/test_validate.py +47 -0
  71. tests/unit/server/test_validate.py +17 -4
  72. {cactus_test_definitions-1.6.0.dist-info → cactus_test_definitions-1.8.1.dist-info}/WHEEL +0 -0
  73. {cactus_test_definitions-1.6.0.dist-info → cactus_test_definitions-1.8.1.dist-info}/licenses/LICENSE.txt +0 -0
  74. {cactus_test_definitions-1.6.0.dist-info → cactus_test_definitions-1.8.1.dist-info}/top_level.txt +0 -0
@@ -151,3 +151,50 @@ def test_procedures_have_required_preconditions(tp_id: TestProcedureId):
151
151
  ):
152
152
  assert tp.preconditions.checks is not None
153
153
  assert any([check.type == "der-settings-contents" for check in tp.preconditions.checks])
154
+
155
+
156
+ @pytest.mark.parametrize("tp_id", TestProcedureId)
157
+ def test_response_subject_tags_have_corresponding_der_control_tags(tp_id: TestProcedureId):
158
+ """Ensures that every subject_tag in response-contents checks has a corresponding
159
+ tag defined in a create-der-control action in the same test procedure."""
160
+
161
+ tp = get_test_procedure(tp_id)
162
+
163
+ # Collect all tags defined in create-der-control actions
164
+ der_control_tags = set()
165
+
166
+ if tp.preconditions and tp.preconditions.actions:
167
+ der_control_tags.update(
168
+ [
169
+ a.parameters.get("tag")
170
+ for a in tp.preconditions.actions
171
+ if a.type == "create-der-control" and a.parameters and a.parameters.get("tag")
172
+ ]
173
+ )
174
+
175
+ der_control_tags.update(
176
+ [
177
+ a.parameters.get("tag")
178
+ for s in tp.steps.values()
179
+ for a in s.actions
180
+ if a.type == "create-der-control" and a.parameters and a.parameters.get("tag")
181
+ ]
182
+ )
183
+
184
+ # Collect all subject_tags referenced in response-contents checks
185
+ referenced_subject_tags = set(
186
+ [
187
+ c.parameters.get("subject_tag")
188
+ for s in tp.steps.values()
189
+ if s.event.checks
190
+ for c in s.event.checks
191
+ if c.type == "response-contents" and c.parameters and c.parameters.get("subject_tag")
192
+ ]
193
+ )
194
+
195
+ # Verify all referenced subject_tags have corresponding der-control tags
196
+ missing_tags = referenced_subject_tags - der_control_tags
197
+ assert not missing_tags, (
198
+ f"The following subject_tags in response-contents checks do not have corresponding "
199
+ f"tags in create-der-control actions: {missing_tags}"
200
+ )
@@ -32,11 +32,13 @@ def test_each_alias_defined(tp_id: str):
32
32
 
33
33
  # sanity check - make sure we are looking for the action names that are valid
34
34
  UPSERT_MUP_ACTION = "upsert-mup"
35
- INSERT_MUP_ACTION = "insert-readings"
35
+ INSERT_READING_ACTION = "insert-readings"
36
36
  CREATE_SUB_ACTION = "create-subscription"
37
37
  DELETE_SUB_ACTION = "delete-subscription"
38
38
  assert UPSERT_MUP_ACTION in ACTION_PARAMETER_SCHEMA, "If this fails - the action name has changed. Update this test"
39
- assert INSERT_MUP_ACTION in ACTION_PARAMETER_SCHEMA, "If this fails - the action name has changed. Update this test"
39
+ assert (
40
+ INSERT_READING_ACTION in ACTION_PARAMETER_SCHEMA
41
+ ), "If this fails - the action name has changed. Update this test"
40
42
  assert CREATE_SUB_ACTION in ACTION_PARAMETER_SCHEMA, "If this fails - the action name has changed. Update this test"
41
43
  assert DELETE_SUB_ACTION in ACTION_PARAMETER_SCHEMA, "If this fails - the action name has changed. Update this test"
42
44
 
@@ -51,12 +53,23 @@ def test_each_alias_defined(tp_id: str):
51
53
  sub_id = None
52
54
 
53
55
  if step.action.type == UPSERT_MUP_ACTION:
54
- assert mup_id and (mup_id not in mup_aliases_found), "mup_id is already defined in this test."
55
56
  mup_aliases_found.add(mup_id)
56
- elif step.action.type == INSERT_MUP_ACTION:
57
+ elif step.action.type == INSERT_READING_ACTION:
57
58
  assert mup_id and (mup_id in mup_aliases_found), "mup_id hasn't been defined yet."
58
59
  elif step.action.type == CREATE_SUB_ACTION:
59
60
  assert sub_id and (sub_id not in sub_aliases_found), "sub_id is already defined in this test."
60
61
  sub_aliases_found.add(sub_id)
61
62
  elif step.action.type == DELETE_SUB_ACTION:
62
63
  assert sub_id and (sub_id in sub_aliases_found), "sub_id hasn't been defined yet."
64
+
65
+ # Any instance of "sub_id" / "mup_id" in a check must have ALSO been defined in an earlier action
66
+ for check in step.checks or []:
67
+ sub_id = check.parameters.get("sub_id", None)
68
+ if sub_id:
69
+ # This will match
70
+ assert sub_id and (sub_id in sub_aliases_found), "sub_id hasn't been defined yet."
71
+
72
+ mup_id = check.parameters.get("mup_id", None)
73
+ if mup_id:
74
+ # This will match
75
+ assert mup_id and (mup_id in mup_aliases_found), "mup_id hasn't been defined yet."