Compare commits
No commits in common. "61c81e05b6f8f8914f5238979706a028fde0de85" and "7c26cf252db2bfe1c3510ae93a517c29e216f730" have entirely different histories.
61c81e05b6
...
7c26cf252d
@ -24,12 +24,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
cache: true
|
cache: true
|
||||||
python-version: ~3.11
|
python-version: ~3.11
|
||||||
token: ""
|
|
||||||
- name: Install apt dependencies
|
- name: Install apt dependencies
|
||||||
run: >-
|
run: >-
|
||||||
sudo apt-get update &&
|
sudo apt-get update &&
|
||||||
sudo apt-get -y install build-essential python3-dev libldap2-dev libsasl2-dev mariadb-client
|
sudo apt-get -y install build-essential python3-dev libldap2-dev libsasl2-dev mariadb-client
|
||||||
- name: Install python dependencies
|
- name: Install python dependencies
|
||||||
run: pdm sync -d
|
run: pdm install
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pdm run -v ./manage.py test --parallel auto
|
run: pdm run ./manage.py test --parallel auto
|
||||||
|
@ -19,11 +19,6 @@ repos:
|
|||||||
- id: ruff
|
- id: ruff
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
|
|
||||||
- repo: https://github.com/pdm-project/pdm
|
|
||||||
rev: 2.12.3
|
|
||||||
hooks:
|
|
||||||
- id: pdm-lock-check
|
|
||||||
|
|
||||||
# TODO: waiting on django-recurrence 1.12 to be released on PyPi
|
# TODO: waiting on django-recurrence 1.12 to be released on PyPi
|
||||||
# - repo: local
|
# - repo: local
|
||||||
# hooks:
|
# hooks:
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
from hypothesis import settings
|
|
||||||
|
|
||||||
from .base import * # noqa: F403
|
from .base import * # noqa: F403
|
||||||
from .hypothesis import configure_hypothesis_profiles
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||||
@ -34,5 +31,3 @@ DATABASES = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
configure_hypothesis_profiles()
|
|
||||||
settings.load_profile("ci")
|
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
from hypothesis import settings
|
|
||||||
|
|
||||||
from .base import * # noqa: F403
|
from .base import * # noqa: F403
|
||||||
from .hypothesis import configure_hypothesis_profiles
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||||
@ -18,6 +13,3 @@ INSTALLED_APPS.append("debug_toolbar") # noqa: F405
|
|||||||
INSTALLED_APPS.append("django_extensions") # noqa: F405
|
INSTALLED_APPS.append("django_extensions") # noqa: F405
|
||||||
|
|
||||||
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405
|
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405
|
||||||
|
|
||||||
configure_hypothesis_profiles()
|
|
||||||
settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "dev"))
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
from hypothesis import HealthCheck, Verbosity, settings
|
|
||||||
|
|
||||||
|
|
||||||
def configure_hypothesis_profiles():
|
|
||||||
settings.register_profile("ci", suppress_health_check=(HealthCheck.too_slow,))
|
|
||||||
settings.register_profile("dev", max_examples=20)
|
|
||||||
settings.register_profile("debug", max_examples=10, verbosity=Verbosity.verbose)
|
|
@ -1,5 +1,3 @@
|
|||||||
from itertools import chain
|
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
@ -80,42 +78,29 @@ class InstructorOrVendorReportTestCase(PermissionRequiredViewTestCaseMixin, Test
|
|||||||
|
|
||||||
|
|
||||||
@st.composite
|
@st.composite
|
||||||
def random_certifications(
|
def random_certifications(draw):
|
||||||
draw,
|
departments = draw(st.lists(from_model(Department), min_size=1))
|
||||||
) -> list[Certification]:
|
definitions = draw(
|
||||||
def certifications(version: CertificationVersion):
|
st.lists(
|
||||||
return st.lists(
|
|
||||||
from_model(
|
from_model(
|
||||||
Certification,
|
CertificationDefinition, department=st.sampled_from(departments)
|
||||||
number=st.none(),
|
|
||||||
certification_version=st.just(version),
|
|
||||||
),
|
),
|
||||||
max_size=10,
|
min_size=1,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
def versions_with_certifications(definition: CertificationDefinition):
|
certification_versions = draw(
|
||||||
return st.lists(
|
st.lists(
|
||||||
from_model(CertificationVersion, definition=st.just(definition)).flatmap(
|
from_model(CertificationVersion, definition=st.sampled_from(definitions)),
|
||||||
certifications
|
min_size=1,
|
||||||
),
|
|
||||||
max_size=2,
|
|
||||||
)
|
|
||||||
|
|
||||||
def definitions_with_versions(department: Department):
|
|
||||||
return st.lists(
|
|
||||||
from_model(CertificationDefinition, department=st.just(department)).flatmap(
|
|
||||||
versions_with_certifications
|
|
||||||
),
|
|
||||||
max_size=2,
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
return draw(
|
return draw(
|
||||||
st.lists(
|
st.lists(
|
||||||
from_model(Department).flatmap(definitions_with_versions),
|
from_model(
|
||||||
max_size=2,
|
Certification,
|
||||||
).map(
|
number=st.none(),
|
||||||
lambda x: list(
|
certification_version=st.sampled_from(certification_versions),
|
||||||
chain.from_iterable(chain.from_iterable(chain.from_iterable(x)))
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -126,7 +111,7 @@ class CertifiersReportTestCase(PermissionRequiredViewTestCaseMixin, TestCase):
|
|||||||
path = "/paperwork/certifiers"
|
path = "/paperwork/certifiers"
|
||||||
|
|
||||||
@given(certifications=random_certifications())
|
@given(certifications=random_certifications())
|
||||||
def test_certifiers_report(self, certifications: list[Certification]) -> None:
|
def test_certifers_report(self, certifications: list[Certification]) -> None:
|
||||||
self.client.force_login(self.user_with_permission)
|
self.client.force_login(self.user_with_permission)
|
||||||
response = self.client.get(self.path)
|
response = self.client.get(self.path)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
Loading…
Reference in New Issue
Block a user