django-octo-qa 0.1.0__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.
- django_octo_qa-0.1.0/.github/workflows/ci.yml +49 -0
- django_octo_qa-0.1.0/.github/workflows/publish.yml +46 -0
- django_octo_qa-0.1.0/.github/workflows/security.yml +79 -0
- django_octo_qa-0.1.0/.gitignore +30 -0
- django_octo_qa-0.1.0/LICENSE +21 -0
- django_octo_qa-0.1.0/PKG-INFO +62 -0
- django_octo_qa-0.1.0/README.md +42 -0
- django_octo_qa-0.1.0/TESTING.md +50 -0
- django_octo_qa-0.1.0/config/__init__.py +0 -0
- django_octo_qa-0.1.0/config/asgi.py +16 -0
- django_octo_qa-0.1.0/config/settings.py +136 -0
- django_octo_qa-0.1.0/config/urls.py +24 -0
- django_octo_qa-0.1.0/config/wsgi.py +16 -0
- django_octo_qa-0.1.0/features/environment.py +17 -0
- django_octo_qa-0.1.0/features/qa_orchestrator.feature +17 -0
- django_octo_qa-0.1.0/features/steps/qa_steps.py +93 -0
- django_octo_qa-0.1.0/manage.py +23 -0
- django_octo_qa-0.1.0/performance/locustfile.py +32 -0
- django_octo_qa-0.1.0/pyproject.toml +47 -0
- django_octo_qa-0.1.0/pytest.ini +4 -0
- django_octo_qa-0.1.0/requirements-dev.lock +135 -0
- django_octo_qa-0.1.0/requirements.lock +135 -0
- django_octo_qa-0.1.0/src/django_octo_qa/__init__.py +3 -0
- django_octo_qa-0.1.0/src/django_octo_qa/admin.py +96 -0
- django_octo_qa-0.1.0/src/django_octo_qa/apps.py +7 -0
- django_octo_qa-0.1.0/src/django_octo_qa/discovery.py +91 -0
- django_octo_qa-0.1.0/src/django_octo_qa/migrations/0001_initial.py +32 -0
- django_octo_qa-0.1.0/src/django_octo_qa/migrations/__init__.py +0 -0
- django_octo_qa-0.1.0/src/django_octo_qa/models.py +34 -0
- django_octo_qa-0.1.0/src/django_octo_qa/runner.py +154 -0
- django_octo_qa-0.1.0/src/django_octo_qa/templates/admin/django_octo_qa/qa_dashboard.html +192 -0
- django_octo_qa-0.1.0/src/django_octo_qa/urls.py +8 -0
- django_octo_qa-0.1.0/src/django_octo_qa/views.py +8 -0
- django_octo_qa-0.1.0/tests/__init__.py +0 -0
- django_octo_qa-0.1.0/tests/settings.py +49 -0
- django_octo_qa-0.1.0/tests/test_qa_core.py +54 -0
- django_octo_qa-0.1.0/tests/urls.py +7 -0
- django_octo_qa-0.1.0/tests.zip +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
qa-pipeline:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout repository
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Rye
|
|
18
|
+
uses: eifinger/setup-rye@v4
|
|
19
|
+
with:
|
|
20
|
+
enable-cache: true
|
|
21
|
+
|
|
22
|
+
- name: Synchronize dependencies
|
|
23
|
+
run: |
|
|
24
|
+
rye sync
|
|
25
|
+
rye add --dev pytest-cov
|
|
26
|
+
|
|
27
|
+
- name: Run database migrations
|
|
28
|
+
env:
|
|
29
|
+
PYTHONPATH: src
|
|
30
|
+
run: rye run python manage.py migrate
|
|
31
|
+
|
|
32
|
+
- name: Execute Unit & Integration Suite (pytest)
|
|
33
|
+
env:
|
|
34
|
+
PYTHONPATH: src
|
|
35
|
+
run: rye run pytest --cov=django_octo_qa --cov-report=xml
|
|
36
|
+
|
|
37
|
+
- name: Execute Behavioral Specifications (behave)
|
|
38
|
+
env:
|
|
39
|
+
PYTHONPATH: src
|
|
40
|
+
run: rye run python manage.py behave
|
|
41
|
+
|
|
42
|
+
- name: Upload coverage to Codecov
|
|
43
|
+
uses: codecov/codecov-action@v5
|
|
44
|
+
env:
|
|
45
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
46
|
+
with:
|
|
47
|
+
files: ./coverage.xml
|
|
48
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
49
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
name: Build and publish distribution to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment:
|
|
12
|
+
name: pypi
|
|
13
|
+
url: https://pypi.org
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Setup Rye
|
|
22
|
+
uses: eifinger/setup-rye@v4
|
|
23
|
+
|
|
24
|
+
- name: Build distribution packages
|
|
25
|
+
run: rye build
|
|
26
|
+
|
|
27
|
+
- name: Publish package to PyPI via Trusted Publisher
|
|
28
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
29
|
+
|
|
30
|
+
- name: Trigger Django-Octo Core Sync
|
|
31
|
+
if: success()
|
|
32
|
+
run: |
|
|
33
|
+
API_URL="https://api.github.com"
|
|
34
|
+
ENDPOINT="/repos/jeanpmodev/django_octo/dispatches"
|
|
35
|
+
curl -X POST \
|
|
36
|
+
-H "Accept: application/vnd.github+json" \
|
|
37
|
+
-H "Authorization: Bearer ${{ secrets.OCTO_DISPATCH_TOKEN }}" \
|
|
38
|
+
"${API_URL}${ENDPOINT}" \
|
|
39
|
+
-d '{
|
|
40
|
+
"event_type": "octo-module-released",
|
|
41
|
+
"client_payload": {
|
|
42
|
+
"module": "${{ github.event.repository.name }}",
|
|
43
|
+
"version": "${{ github.ref_name }}",
|
|
44
|
+
"summary": "Automated module release propagated to Django-Octo Core."
|
|
45
|
+
}
|
|
46
|
+
}'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Security Audit
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "0 6 * * 1"
|
|
10
|
+
|
|
11
|
+
permissions: read-all
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
snyk-scan:
|
|
15
|
+
name: Snyk Security Scan
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
security-events: write
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout code
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
|
|
29
|
+
- name: Install project and dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install -e .
|
|
33
|
+
|
|
34
|
+
- name: Install Snyk CLI
|
|
35
|
+
uses: snyk/actions/setup@master
|
|
36
|
+
|
|
37
|
+
- name: Run Snyk to check for vulnerabilities
|
|
38
|
+
run: snyk test --package-manager=pip --file=requirements.lock --sarif-file-output=snyk.sarif
|
|
39
|
+
env:
|
|
40
|
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
|
41
|
+
|
|
42
|
+
- name: Upload Snyk report to GitHub Code Scanning
|
|
43
|
+
uses: github/codeql-action/upload-sarif@v4
|
|
44
|
+
if: always()
|
|
45
|
+
with:
|
|
46
|
+
sarif_file: snyk.sarif
|
|
47
|
+
|
|
48
|
+
ossf-scorecard:
|
|
49
|
+
name: OpenSSF Scorecard
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
permissions:
|
|
52
|
+
security-events: write
|
|
53
|
+
id-token: write
|
|
54
|
+
contents: read
|
|
55
|
+
actions: read
|
|
56
|
+
steps:
|
|
57
|
+
- name: Checkout code
|
|
58
|
+
uses: actions/checkout@v4
|
|
59
|
+
with:
|
|
60
|
+
persist-credentials: false
|
|
61
|
+
|
|
62
|
+
- name: Run analysis
|
|
63
|
+
uses: ossf/scorecard-action@v2.5.0
|
|
64
|
+
with:
|
|
65
|
+
results_file: results.sarif
|
|
66
|
+
results_format: sarif
|
|
67
|
+
publish_results: true
|
|
68
|
+
|
|
69
|
+
- name: Upload artifact
|
|
70
|
+
uses: actions/upload-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: SARIF file
|
|
73
|
+
path: results.sarif
|
|
74
|
+
retention-days: 5
|
|
75
|
+
|
|
76
|
+
- name: Upload to code-scanning
|
|
77
|
+
uses: github/codeql-action/upload-sarif@v4
|
|
78
|
+
with:
|
|
79
|
+
sarif_file: results.sarif
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# python generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# ==========================================
|
|
10
|
+
# Rye / Python Environment
|
|
11
|
+
# ==========================================
|
|
12
|
+
.venv/
|
|
13
|
+
.python-version
|
|
14
|
+
.project-id
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.pyc
|
|
17
|
+
*.pyo
|
|
18
|
+
*.pyd
|
|
19
|
+
.pytest_cache/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
.mypy_cache/
|
|
22
|
+
|
|
23
|
+
# ==========================================
|
|
24
|
+
# Django Local Configurations & Media
|
|
25
|
+
# ==========================================
|
|
26
|
+
.env
|
|
27
|
+
local_settings.py
|
|
28
|
+
media/
|
|
29
|
+
staticfiles/
|
|
30
|
+
db.sqlite3
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jeanpmodev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: django-octo-qa
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unified Django quality assurance and automated test runner (Pytest, Behave BDD, Locust) under Django-Octo.
|
|
5
|
+
Project-URL: Homepage, https://github.com
|
|
6
|
+
Project-URL: Repository, https://github.com
|
|
7
|
+
Author-email: jeanpmodev <jeanpmodev@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: bdd,behave,django,locust,octo,pytest,qa,testing
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Requires-Dist: behave-django>=2.0.0
|
|
13
|
+
Requires-Dist: behave>=1.3.3
|
|
14
|
+
Requires-Dist: django>=6.1.2
|
|
15
|
+
Requires-Dist: locust>=2.47.0
|
|
16
|
+
Requires-Dist: pytest-django>=4.14.0
|
|
17
|
+
Requires-Dist: pytest>=9.2.0
|
|
18
|
+
Requires-Dist: python-dotenv
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# Django-Octo QA
|
|
22
|
+
|
|
23
|
+
**Unified Django quality assurance and automated test orchestrator (Pytest, Behave BDD, and Locust) under the Django-Octo ecosystem.**
|
|
24
|
+
|
|
25
|
+
`django-octo-qa` automatically discovers unit tests (`pytest`), behavioral specifications (`behave`), and load test suites (`locust`) across your Django apps and executes them safely from the Django Admin with persistent execution history.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Granular Test Discovery:** Scans installed apps and project roots to list individual Pytest functions, Behave scenarios, and Locust user classes.
|
|
30
|
+
- **On-Demand Execution:** Run individual test cases or full suites directly from **Admin -> QA -> Quality Assurance**.
|
|
31
|
+
- **Execution History & Log Viewer:** Stores timestamps, target scope, duration, status badges, full console logs (with one-click copy), and downloadable Locust HTML reports.
|
|
32
|
+
- **Production Safety Guardrails:** Restricted to superusers and requires `OCTO_QA_ALLOW_RUNNER = True` (enabled automatically when `DEBUG = True`).
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install django-octo-qa
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
1. Add `django_octo_qa` to `INSTALLED_APPS` in `settings.py`:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
INSTALLED_APPS = [
|
|
46
|
+
# ...
|
|
47
|
+
"django.contrib.admin",
|
|
48
|
+
"django_octo_qa",
|
|
49
|
+
]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
2. Run migrations:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python manage.py migrate django_octo_qa
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
3. Open **Admin -> QA -> Quality Assurance** to inspect discovered tests and run suites.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT License.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Django-Octo QA
|
|
2
|
+
|
|
3
|
+
**Unified Django quality assurance and automated test orchestrator (Pytest, Behave BDD, and Locust) under the Django-Octo ecosystem.**
|
|
4
|
+
|
|
5
|
+
`django-octo-qa` automatically discovers unit tests (`pytest`), behavioral specifications (`behave`), and load test suites (`locust`) across your Django apps and executes them safely from the Django Admin with persistent execution history.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Granular Test Discovery:** Scans installed apps and project roots to list individual Pytest functions, Behave scenarios, and Locust user classes.
|
|
10
|
+
- **On-Demand Execution:** Run individual test cases or full suites directly from **Admin -> QA -> Quality Assurance**.
|
|
11
|
+
- **Execution History & Log Viewer:** Stores timestamps, target scope, duration, status badges, full console logs (with one-click copy), and downloadable Locust HTML reports.
|
|
12
|
+
- **Production Safety Guardrails:** Restricted to superusers and requires `OCTO_QA_ALLOW_RUNNER = True` (enabled automatically when `DEBUG = True`).
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install django-octo-qa
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
1. Add `django_octo_qa` to `INSTALLED_APPS` in `settings.py`:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
INSTALLED_APPS = [
|
|
26
|
+
# ...
|
|
27
|
+
"django.contrib.admin",
|
|
28
|
+
"django_octo_qa",
|
|
29
|
+
]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. Run migrations:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python manage.py migrate django_octo_qa
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
3. Open **Admin -> QA -> Quality Assurance** to inspect discovered tests and run suites.
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
MIT License.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Quality Assurance & Testing Methodology
|
|
2
|
+
|
|
3
|
+
[](#2-unit--query-count-validation-pytest)
|
|
4
|
+
[](#3-behavioral--bdd-specifications-behave)
|
|
5
|
+
[](performance/locust_load_report.pdf)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. On-Demand QA Setup
|
|
10
|
+
Inside an isolated virtual environment, install the validation stack:
|
|
11
|
+
```bash
|
|
12
|
+
rye add pytest pytest-django behave locust
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Unit & Query-Count Validation (`pytest`)
|
|
18
|
+
Verifies schema migrations, OSV API vulnerability batch parsing, advisory enrichment, and enforces the **Single Database Lookup (`assertNumQueries(1)`)** contract on `/security-audit/`:
|
|
19
|
+
```bash
|
|
20
|
+
PYTHONPATH=src rye run pytest
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 3. Behavioral / BDD Specifications (`behave`)
|
|
26
|
+
Executes Gherkin scenarios (`features/security_audit.feature`) validating the runtime posture endpoint and CVE environment audit scanner end-to-end:
|
|
27
|
+
```bash
|
|
28
|
+
PYTHONPATH=src rye run behave
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 4. Load & Concurrency Stress Benchmark (`locust`)
|
|
34
|
+
Simulates concurrent requests hitting the live `/security-audit/` posture endpoint to verify zero-error stability under load:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Terminal 1: Start runtime service
|
|
38
|
+
rye run python3 manage.py runserver --noreload
|
|
39
|
+
|
|
40
|
+
# Terminal 2: Execute headless load benchmark
|
|
41
|
+
rye run locust -f performance/locustfile.py --headless -u 20 -r 5 -t 10s --host http://127.0.0.1:8000
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Benchmark Summary
|
|
45
|
+
* **Failure Rate:** `0.00%` (HTTP 200 OK across all posture audit requests)
|
|
46
|
+
* **Query Overhead:** Strict `1 query` per request (`CveAuditScan.objects.first()`)
|
|
47
|
+
* **Detailed Metrics:** Available in the exported report below.
|
|
48
|
+
|
|
49
|
+
**[View Official Locust Load Test Report (PDF)](performance/locust_load_report.pdf)**
|
|
50
|
+
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ASGI config for config project.
|
|
3
|
+
|
|
4
|
+
It exposes the ASGI callable as a module-level variable named ``application``.
|
|
5
|
+
|
|
6
|
+
For more information on this file, see
|
|
7
|
+
https://docs.djangoproject.com/en/6.1/howto/deployment/asgi/
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from django.core.asgi import get_asgi_application
|
|
13
|
+
|
|
14
|
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
|
15
|
+
|
|
16
|
+
application = get_asgi_application()
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Django settings for config project.
|
|
3
|
+
|
|
4
|
+
Generated by 'django-admin startproject' using Django 6.1.2.
|
|
5
|
+
|
|
6
|
+
For more information on this file, see
|
|
7
|
+
https://docs.djangoproject.com/en/6.1/topics/settings/
|
|
8
|
+
|
|
9
|
+
For the full list of settings and their values, see
|
|
10
|
+
https://docs.djangoproject.com/en/6.1/ref/settings/
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from dotenv import load_dotenv
|
|
16
|
+
|
|
17
|
+
# 1. First, build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
18
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
19
|
+
|
|
20
|
+
# 2. Then, load environment variables from the .env file using BASE_DIR
|
|
21
|
+
load_dotenv(BASE_DIR / ".env")
|
|
22
|
+
|
|
23
|
+
# Quick-start development settings - unsuitable for production
|
|
24
|
+
# See https://docs.djangoproject.com/en/6.1/howto/deployment/checklist/
|
|
25
|
+
|
|
26
|
+
# SECURITY WARNING: keep the secret key used in production secret!
|
|
27
|
+
SECRET_KEY = os.getenv(
|
|
28
|
+
"SECRET_KEY", "django-insecure-production-fallback-key-change-in-env"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# SECURITY WARNING: don't run with debug turned on in production!
|
|
32
|
+
DEBUG = True
|
|
33
|
+
|
|
34
|
+
ALLOWED_HOSTS = []
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# Application definition
|
|
38
|
+
|
|
39
|
+
INSTALLED_APPS = [
|
|
40
|
+
"django.contrib.admin",
|
|
41
|
+
"django.contrib.auth",
|
|
42
|
+
"django.contrib.contenttypes",
|
|
43
|
+
"django.contrib.sessions",
|
|
44
|
+
"django.contrib.messages",
|
|
45
|
+
"django.contrib.staticfiles",
|
|
46
|
+
"django_octo_qa",
|
|
47
|
+
"behave_django",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
MIDDLEWARE = [
|
|
51
|
+
"django.middleware.security.SecurityMiddleware",
|
|
52
|
+
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
53
|
+
"django.middleware.common.CommonMiddleware",
|
|
54
|
+
"django.middleware.csrf.CsrfViewMiddleware",
|
|
55
|
+
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
56
|
+
"django.contrib.messages.middleware.MessageMiddleware",
|
|
57
|
+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
ROOT_URLCONF = "config.urls"
|
|
61
|
+
|
|
62
|
+
TEMPLATES = [
|
|
63
|
+
{
|
|
64
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
65
|
+
"DIRS": [BASE_DIR / "templates"],
|
|
66
|
+
"APP_DIRS": True,
|
|
67
|
+
"OPTIONS": {
|
|
68
|
+
"context_processors": [
|
|
69
|
+
"django.template.context_processors.debug",
|
|
70
|
+
"django.template.context_processors.request",
|
|
71
|
+
"django.contrib.auth.context_processors.auth",
|
|
72
|
+
"django.contrib.messages.context_processors.messages",
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
WSGI_APPLICATION = "config.wsgi.application"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# Database
|
|
82
|
+
# https://docs.djangoproject.com/en/6.1/ref/settings/#databases
|
|
83
|
+
|
|
84
|
+
DATABASES = {
|
|
85
|
+
"default": {
|
|
86
|
+
"ENGINE": "django.db.backends.sqlite3",
|
|
87
|
+
"NAME": BASE_DIR / "db.sqlite3",
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
# Password validation
|
|
93
|
+
# https://docs.djangoproject.com/en/6.1/ref/settings/#auth-password-validators
|
|
94
|
+
|
|
95
|
+
AUTH_PASSWORD_VALIDATORS = [
|
|
96
|
+
{
|
|
97
|
+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
|
107
|
+
},
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# Internationalization
|
|
112
|
+
# https://docs.djangoproject.com/en/6.1/topics/i18n/
|
|
113
|
+
|
|
114
|
+
LANGUAGE_CODE = "en-us"
|
|
115
|
+
|
|
116
|
+
TIME_ZONE = "UTC"
|
|
117
|
+
|
|
118
|
+
USE_I18N = True
|
|
119
|
+
|
|
120
|
+
USE_TZ = True
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# Static files (CSS, JavaScript, Images)
|
|
124
|
+
# https://docs.djangoproject.com/en/6.1/howto/static-files/
|
|
125
|
+
|
|
126
|
+
STATIC_URL = "static/"
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
# Email
|
|
130
|
+
# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration
|
|
131
|
+
|
|
132
|
+
MAILERS = {
|
|
133
|
+
"default": {
|
|
134
|
+
"BACKEND": "django.core.mail.backends.console.EmailBackend",
|
|
135
|
+
},
|
|
136
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""
|
|
2
|
+
URL configuration for config project.
|
|
3
|
+
|
|
4
|
+
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
5
|
+
https://docs.djangoproject.com/en/6.1/topics/http/urls/
|
|
6
|
+
Examples:
|
|
7
|
+
Function views
|
|
8
|
+
1. Add an import: from my_app import views
|
|
9
|
+
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
|
10
|
+
Class-based views
|
|
11
|
+
1. Add an import: from other_app.views import Home
|
|
12
|
+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
|
13
|
+
Including another URLconf
|
|
14
|
+
1. Import the include() function: from django.urls import include, path
|
|
15
|
+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from django.contrib import admin
|
|
19
|
+
from django.urls import path, include
|
|
20
|
+
|
|
21
|
+
urlpatterns = [
|
|
22
|
+
path("admin/", admin.site.urls),
|
|
23
|
+
path("", include("django_octo_qa.urls")),
|
|
24
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
WSGI config for config project.
|
|
3
|
+
|
|
4
|
+
It exposes the WSGI callable as a module-level variable named ``application``.
|
|
5
|
+
|
|
6
|
+
For more information on this file, see
|
|
7
|
+
https://docs.djangoproject.com/en/6.1/howto/deployment/wsgi/
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from django.core.wsgi import get_wsgi_application
|
|
13
|
+
|
|
14
|
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
|
15
|
+
|
|
16
|
+
application = get_wsgi_application()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import django
|
|
5
|
+
from django.core.management import call_command
|
|
6
|
+
|
|
7
|
+
ROOT_DIR = Path(__file__).resolve().parent.parent
|
|
8
|
+
if str(ROOT_DIR) not in sys.path:
|
|
9
|
+
sys.path.insert(0, str(ROOT_DIR))
|
|
10
|
+
|
|
11
|
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
|
|
12
|
+
django.setup()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def before_all(context):
|
|
16
|
+
call_command("migrate", "--run-syncdb", verbosity=0)
|
|
17
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Feature: Unified Quality Assurance Orchestrator
|
|
2
|
+
As a Django developer or QA engineer
|
|
3
|
+
I want to discover and inspect Pytest, Behave, and Locust suites from the admin panel
|
|
4
|
+
So that I can track test execution history across all project apps
|
|
5
|
+
|
|
6
|
+
Background:
|
|
7
|
+
Given an authenticated QA superuser exists
|
|
8
|
+
|
|
9
|
+
Scenario: View discovered test inventory by app and test case
|
|
10
|
+
When the superuser opens the Quality Assurance dashboard
|
|
11
|
+
Then the response status code should be 200
|
|
12
|
+
And the inventory table should list discovered test cases
|
|
13
|
+
|
|
14
|
+
Scenario: Delete an archived execution record from history
|
|
15
|
+
Given an archived QA execution record exists
|
|
16
|
+
When the superuser deletes the archived QA execution record
|
|
17
|
+
Then the execution record should be removed from the database
|