atlas-init 0.3.6__py3-none-any.whl → 0.3.7__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.
atlas_init/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from pathlib import Path
2
2
 
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.7"
4
4
 
5
5
 
6
6
  def running_in_repo() -> bool:
@@ -32,7 +32,16 @@ class PathHeadersPayload(Entity):
32
32
 
33
33
  @property
34
34
  def expect_list_response(self) -> bool:
35
- return self.method == "GET" and self.path.endswith("s") and all(not c.isdigit() for c in self.path)
35
+ final_path = self.path.split("/")[-1]
36
+ if final_path in {"settings", "processArgs"}:
37
+ return False
38
+ return self.method == "GET" and self.path.endswith("s") and all(not c.isdigit() for c in final_path)
39
+
40
+ @model_validator(mode="after")
41
+ def normalize_path(self) -> Self:
42
+ if "?" in self.path:
43
+ self.path = self.path.split("?", 1)[0]
44
+ return self
36
45
 
37
46
 
38
47
  def parse_request(request_lines: list[str]) -> PathHeadersPayload:
@@ -107,13 +116,28 @@ class SDKRoundtrip(Entity):
107
116
  return extract_version(content_type_req)
108
117
  raise ValueError(f"Could not extract version from req/resp: {content_type} or {content_type_req}")
109
118
 
119
+ @property
120
+ def java_method_match(self) -> bool:
121
+ java_method = self.response.headers.get("X-Java-Method")
122
+ if not java_method:
123
+ return False
124
+ java_method_final = java_method.split("::")[-1]
125
+ final_req_path = self.request.path.split("/")[-1]
126
+ return final_req_path.lower() in java_method_final.lower()
127
+
110
128
  @model_validator(mode="after")
111
129
  def ensure_match(self) -> Self:
130
+ if self.java_method_match:
131
+ return self
112
132
  req = self.request
113
133
  resp = self.response
114
- _, resp_payload_list, __ = parsed(resp.text)
115
- if req.expect_list_response and resp_payload_list is None:
134
+ resp_payload_dict, resp_payload_list, __ = parsed(resp.text)
135
+ resp_payload_dict = resp_payload_dict or {}
136
+ want_list = req.expect_list_response
137
+ if want_list and resp_payload_list is None and "results" not in resp_payload_dict:
116
138
  raise ValueError(f"Expected list response but got dict: {resp.text}")
139
+ if not want_list and (resp_payload_list or "results" in resp_payload_dict):
140
+ raise ValueError(f"Expected dict response but got list: {resp.text}")
117
141
  return self
118
142
 
119
143
  def __lt__(self, other) -> bool:
@@ -201,7 +225,7 @@ def match_request(
201
225
  step_number=step_number,
202
226
  )
203
227
  remaining_responses = [resp for i, resp in enumerate(responses_list) if i not in used_responses]
204
- err_msg = f"Could not match request {ref} with any response\n\n{request}\n\n\nThere are #{len(remaining_responses)} responses left that doesn't match\n{'-'*80}\n{'\n'.join(r.text for r in remaining_responses)}"
228
+ err_msg = f"Could not match request {request.path} ({ref}) with any response\n\n{request}\n\n\nThere are #{len(remaining_responses)} responses left that doesn't match\n{'-'*80}\n{'\n'.join(r.text for r in remaining_responses)}"
205
229
  raise ValueError(err_msg)
206
230
 
207
231
 
@@ -101,8 +101,6 @@ class MockRequestData(Entity):
101
101
  is_diff: bool,
102
102
  ):
103
103
  step = self.steps[rt.step_number - 1]
104
- if rt.request.method == "PATCH":
105
- logger.info(f"PATCH: {rt.request.path}")
106
104
  step.add_request(
107
105
  normalized_path,
108
106
  rt.request.method,
@@ -184,6 +184,6 @@ def log_diff_roundtrips(roundtrips: list[SDKRoundtrip], differ: Callable[[SDKRou
184
184
  step_nr = rt.step_number
185
185
  diff_count += 1
186
186
  logger.info(
187
- f"\n{rt.request.method} {rt.request.path}\n{rt.request.text}\n{rt.response.status}-{rt.response.status_text}\n{rt.response.text}"
187
+ f"\n{rt.request.method} {rt.request.path} {rt.version}\n{rt.request.text}\n{rt.response.status}-{rt.response.status_text}\n{rt.response.text}"
188
188
  )
189
189
  logger.info(f"Diffable requests: {diff_count}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: atlas-init
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Project-URL: Documentation, https://github.com/EspenAlbert/atlas-init#readme
5
5
  Project-URL: Issues, https://github.com/EspenAlbert/atlas-init/issues
6
6
  Project-URL: Source, https://github.com/EspenAlbert/atlas-init
@@ -1,4 +1,4 @@
1
- atlas_init/__init__.py,sha256=013oNfbE-2O9o7wGJ0RfU_mp9JM2EfwATjKXG2D_v6I,372
1
+ atlas_init/__init__.py,sha256=6fPQOXGNVhrm-NHeu2MniZbhzKrbg2XjuDcXCG4gGqY,372
2
2
  atlas_init/__main__.py,sha256=dY1dWWvwxRZMmnOFla6RSfti-hMeLeKdoXP7SVYqMUc,52
3
3
  atlas_init/atlas_init.yaml,sha256=OAosOZw4kjhTWcPeEv0jtztRFWRhsie8D9r5afySAxM,2065
4
4
  atlas_init/cli.py,sha256=xOnAOUccHDLkivICdF0GsLhccr_IxvnTKTbe1KGW7kU,8971
@@ -24,14 +24,14 @@ atlas_init/cli_root/trigger.py,sha256=oEgqb_l25tyYgUaFHEuChcOCJA7k3mnRa4D-Myz-Ig
24
24
  atlas_init/cli_tf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  atlas_init/cli_tf/app.py,sha256=0Y5c-Pc9ibOz6kXvFlL-yhH_fx1nHLgBgK9OAVqjX9s,11390
26
26
  atlas_init/cli_tf/changelog.py,sha256=biWYKf1pZvXZ-jEgcZ5q9sY7nTGrL2PuI0h9mCILf_g,3181
27
- atlas_init/cli_tf/debug_logs.py,sha256=q71ZNOnQOz1ikPCyqUz_6zyd4Bm1QVkCkTcixJBZ1xI,8988
28
- atlas_init/cli_tf/debug_logs_test_data.py,sha256=G4pnuWJ7PAQd3NXRKAtwAPC6Ne-PgpzaTZHQ9waqxZI,9565
27
+ atlas_init/cli_tf/debug_logs.py,sha256=NvIEtOb30aK_drYgNyYDsXt7uNtw6L9vhIZicANyDRQ,10022
28
+ atlas_init/cli_tf/debug_logs_test_data.py,sha256=-KfhlVgp00zXzV0XMVbABEwKpBZ_r2B-cjBKLuhiBZU,9471
29
29
  atlas_init/cli_tf/debug_logs_test_data_package_config.py,sha256=BOAgln1pWne_ZhP6a0SM2ddn2csr0sgGkYf2kMS_V9o,1666
30
30
  atlas_init/cli_tf/github_logs.py,sha256=VD7qhlXNuG21eTuJ5VI7rsflp5WHSodfngkRVgQlumw,8114
31
31
  atlas_init/cli_tf/go_test_run.py,sha256=LQUQ-3zJ8EUCixwu33QTAzUns3um793osst8tE0UKjk,6792
32
32
  atlas_init/cli_tf/go_test_run_format.py,sha256=OUd6QPHDeTzbwVuh6MhP-xXgjOOGP9W_sCLJ8KylBTs,1201
33
33
  atlas_init/cli_tf/go_test_summary.py,sha256=agr4SITgxchjgOzRpScoTUk-iG38QDLkpnsMtTW9GTY,5382
34
- atlas_init/cli_tf/mock_tf_log.py,sha256=rYUpkN1oOWk1ncy99J-Jb9p7wL073XnO-PdfFRnYnR8,7533
34
+ atlas_init/cli_tf/mock_tf_log.py,sha256=1Q5OWkDM1Dxac5vhG-vMVGScDBnXmwruZjsHDya5Uu4,7546
35
35
  atlas_init/cli_tf/schema.py,sha256=iwvb4wD2Wba0MMu7ooTNAIi1jHbpLiXGPOT51_o_YW8,12431
36
36
  atlas_init/cli_tf/schema_go_parser.py,sha256=PiRfFFVnkhltxcGFfOCgH53wwzIEynw2BXmSfaINLL8,8294
37
37
  atlas_init/cli_tf/schema_inspection.py,sha256=ujLvGfg3baByND4nRD0drZoI45STxo3VfYvim-PfVOc,1764
@@ -88,7 +88,7 @@ atlas_init/tf/modules/vpc_peering/vpc_peering.tf,sha256=hJ3KJdGbLpOQednUpVuiJ0Cq
88
88
  atlas_init/tf/modules/vpc_privatelink/atlas-privatelink.tf,sha256=FloaaX1MNDvoMZxBnEopeLKyfIlq6kaX2dmx8WWlXNU,1298
89
89
  atlas_init/tf/modules/vpc_privatelink/variables.tf,sha256=gktHCDYD4rz6CEpLg5aiXcFbugw4L5S2Fqc52QYdJyc,255
90
90
  atlas_init/tf/modules/vpc_privatelink/versions.tf,sha256=G0u5V_Hvvrkux_tqfOY05pA-GzSp_qILpfx1dZaTGDc,237
91
- atlas_init-0.3.6.dist-info/METADATA,sha256=OZjhfNhuqps6Lj0ula1qtEaeEqToxHMvkisBrWezRcM,5650
92
- atlas_init-0.3.6.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
93
- atlas_init-0.3.6.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
94
- atlas_init-0.3.6.dist-info/RECORD,,
91
+ atlas_init-0.3.7.dist-info/METADATA,sha256=JsyU3TvkLcpLmTq0QDcuavjTz-J6l31nZf6qsTvljxs,5650
92
+ atlas_init-0.3.7.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
93
+ atlas_init-0.3.7.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
94
+ atlas_init-0.3.7.dist-info/RECORD,,