djcheckup 0.2.1__tar.gz → 0.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: djcheckup
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: DJ Checkup is a security scanner for Django sites.
5
5
  Author: Stuart Maxwell
6
6
  Author-email: Stuart Maxwell <stuart@amanzi.nz>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "djcheckup"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "DJ Checkup is a security scanner for Django sites."
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Stuart Maxwell", email = "stuart@amanzi.nz" }]
@@ -26,5 +26,15 @@ target-version = "py313"
26
26
  [tool.ruff.lint]
27
27
  select = ["ALL"]
28
28
 
29
+ [tool.ruff.lint.extend-per-file-ignores]
30
+ "tests/**" = ["S101", "ANN201", "ANN001", "ARG001"]
31
+
29
32
  [tool.ruff.lint.pydocstyle]
30
33
  convention = "google" # Accepts: "google", "numpy", or "pep257".
34
+
35
+ [dependency-groups]
36
+ dev = ["pytest>=8.4.2"]
37
+
38
+ [tool.pytest.ini_options]
39
+ pythonpath = "."
40
+ python_files = "test_*.py"
@@ -286,6 +286,27 @@ class SchemeCheck(_BaseCheck):
286
286
  return response.url.scheme == self.end_scheme
287
287
 
288
288
 
289
+ def create_context(url: httpx.URL, client: httpx.Client, response: httpx.Response) -> SiteCheckContext:
290
+ """Create a SiteCheckContext context object.
291
+
292
+ Args:
293
+ url: The URL to check.
294
+ client: The HTTPX client to use for requests.
295
+ response: The HTTPX response object from the initial request.
296
+
297
+ Returns:
298
+ A SiteCheckContext object containing the provided parameters.
299
+ """
300
+ return SiteCheckContext(
301
+ url=url,
302
+ client=client,
303
+ headers=response.headers,
304
+ cookies=response.cookies.jar,
305
+ content=response.text,
306
+ response_url=response.url,
307
+ )
308
+
309
+
289
310
  class SiteChecker:
290
311
  """Run all the checks for a given site."""
291
312
 
@@ -359,14 +380,7 @@ class SiteChecker:
359
380
  message=error_message,
360
381
  )
361
382
 
362
- self.context = SiteCheckContext(
363
- url=self.url,
364
- client=self.client,
365
- headers=response.headers,
366
- cookies=response.cookies.jar,
367
- content=response.text,
368
- response_url=response.url,
369
- )
383
+ self.context = create_context(self.url, self.client, response)
370
384
 
371
385
  return CheckResponse(
372
386
  name=check_name,
File without changes
File without changes