diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..1e3977a8 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,52 @@ +version: 2.1 + +orbs: + python: circleci/python@1.2 + common: travelperk/common@3.1.0 + +workflows: + main: + jobs: + - test: + context: [aws, codeartifact] + - publish: + context: [aws, codeartifact] + requires: + - test + filters: + branches: + only: + - main + +jobs: + test: + resource_class: small + docker: + - image: $AWS_ECR_ACCOUNT_URL_US/tk-python:v6.5-3.11.7 + - name: postgres + image: postgres:14.10 + command: -c fsync=off -c full_page_writes=off -c shared_buffers=1024MB -c autovacuum=off -c max_connections=200 -c max_locks_per_transaction=128 + environment: + POSTGRES_PASSWORD: postgres + environment: + TEST_DB_HOST: postgres + TEST_DB_USER: postgres + TEST_DB_PASS: postgres + TEST_DB_NAME: postgres + steps: + - checkout + - run: + name: Install Python dependencies + command: "pip install tox==4.14.2" + - run: + name: Run tests + command: tox -e django-42 + + publish: + resource_class: small + docker: + - image: $AWS_ECR_ACCOUNT_URL_US/tk-python-ci:v6.5-3.11.7 + steps: + - checkout + - run: python setup.py sdist bdist_wheel + - run: twine upload dist/* --skip-existing \ No newline at end of file diff --git a/auditlog_tests/tests.py b/auditlog_tests/tests.py index d75afbe7..41d71f59 100644 --- a/auditlog_tests/tests.py +++ b/auditlog_tests/tests.py @@ -1,5 +1,6 @@ import datetime import json +from unittest import mock import django from dateutil.tz import gettz @@ -182,7 +183,8 @@ class MiddlewareTest(TestCase): """ def setUp(self): - self.middleware = AuditlogMiddleware() + self.get_response_mock = mock.Mock() + self.middleware = AuditlogMiddleware(get_response=self.get_response_mock) self.factory = RequestFactory() self.user = User.objects.create_user( username="test", email="test@example.com", password="top_secret" diff --git a/setup.py b/setup.py index b6ae767b..8fb4604b 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( - name="django-auditlog", + name="tk-django-auditlog", use_scm_version={"version_scheme": "post-release"}, setup_requires=["setuptools_scm"], packages=[ diff --git a/tox.ini b/tox.ini index d4ee81e0..197f9dfc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - {py36,py37,py38,py39}-django-{22,31,32} + {py36,py37,py38,py39,py311}-django-{22,31,32,42} py38-docs py38-qa @@ -12,10 +12,11 @@ deps = django-22: Django>=2.2,<2.3 django-31: Django>=3.1,<3.2 django-32: Django>=3.2,<3.3 + django-42: Django>=4.2,<4.3 # Test requirements coverage codecov - psycopg2-binary>=2.8,<2.9 + psycopg2-binary passenv= TEST_DB_HOST TEST_DB_USER @@ -28,6 +29,7 @@ basepython = py38: python3.8 py37: python3.7 py36: python3.6 + py311: python3.11 [testenv:py38-docs] changedir = docs/source