From ab87293ef0f115492f36dc334a87708eadcda836 Mon Sep 17 00:00:00 2001 From: David Vogt Date: Thu, 22 Jul 2021 09:45:15 +0200 Subject: [PATCH 1/3] feat: begin packaging for pypi --- .github/workflows/pypi.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..d1dba35 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,30 @@ +name: PyPI + +on: + release: + types: [created] + +jobs: + publish: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Remove existing packages + run: rm -rf ./dist/ ./caluma.egg-info/ ./build/ + - name: Run twine + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + TWINE_NON_INTERACTIVE: true + run: | + python setup.py sdist bdist_wheel + twine upload dist/* From 2b0e90063b212c80180f133c96fa9f3dcdae8910 Mon Sep 17 00:00:00 2001 From: David Vogt Date: Thu, 22 Jul 2021 09:50:11 +0200 Subject: [PATCH 2/3] chore: first version to be published - 0.1.1 Also updating some more dependencies --- emeis/emeis_metadata.py | 2 +- requirements-base.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/emeis/emeis_metadata.py b/emeis/emeis_metadata.py index 405ad50..eab6615 100644 --- a/emeis/emeis_metadata.py +++ b/emeis/emeis_metadata.py @@ -2,4 +2,4 @@ __title__ = "emeis" __description__ = "user management" -__version__ = "0.0.0" +__version__ = "0.1.1" diff --git a/requirements-base.txt b/requirements-base.txt index 2bc4d61..121ce42 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -1,10 +1,10 @@ django==2.2.24 django-cors-headers==3.7.0 django-environ==0.4.5 -django-filter==2.3.0 -django-localized-fields==5.4.2 +django-filter==2.4.0 +django-localized-fields==6.4 django_mptt==0.11.0 -django-postgres-extra==1.22 +django-postgres-extra==2.0.2 djangorestframework==3.12.4 djangorestframework-jsonapi==4.1.0 mozilla-django-oidc==1.2.4 From 35435421e97610f42f7288bcbd315f8ce634f937 Mon Sep 17 00:00:00 2001 From: David Vogt Date: Thu, 22 Jul 2021 11:40:06 +0200 Subject: [PATCH 3/3] chore: fix tests and snapshots New version of localized-fields doesn't search across all languages anymore (Did it ever, or did the test only work accidentally?) --- emeis/core/tests/snapshots/snap_test_api.py | 11 +++++------ emeis/core/tests/test_views.py | 3 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/emeis/core/tests/snapshots/snap_test_api.py b/emeis/core/tests/snapshots/snap_test_api.py index 27f4461..5268b4d 100644 --- a/emeis/core/tests/snapshots/snap_test_api.py +++ b/emeis/core/tests/snapshots/snap_test_api.py @@ -1502,7 +1502,7 @@ "queries": [ 'SELECT "emeis_core_permission"."created_at", "emeis_core_permission"."modified_at", "emeis_core_permission"."created_by_user_id", "emeis_core_permission"."meta", "emeis_core_permission"."slug", "emeis_core_permission"."name", "emeis_core_permission"."description" FROM "emeis_core_permission" WHERE "emeis_core_permission"."slug" = \'note-act-source\'', 'SELECT ("emeis_core_role_permissions"."permission_id") AS "_prefetch_related_val_permission_id", "emeis_core_role"."created_at", "emeis_core_role"."modified_at", "emeis_core_role"."created_by_user_id", "emeis_core_role"."meta", "emeis_core_role"."slug", "emeis_core_role"."name", "emeis_core_role"."description" FROM "emeis_core_role" INNER JOIN "emeis_core_role_permissions" ON ("emeis_core_role"."slug" = "emeis_core_role_permissions"."role_id") WHERE "emeis_core_role_permissions"."permission_id" IN (\'note-act-source\') ORDER BY "emeis_core_role"."slug" ASC', - 'SELECT "emeis_core_role_permissions"."id", "emeis_core_role_permissions"."role_id", "emeis_core_role_permissions"."permission_id" FROM "emeis_core_role_permissions" WHERE "emeis_core_role_permissions"."permission_id" IN (\'note-act-source\')', + 'DELETE FROM "emeis_core_role_permissions" WHERE "emeis_core_role_permissions"."permission_id" IN (\'note-act-source\')', 'DELETE FROM "emeis_core_permission" WHERE "emeis_core_permission"."slug" IN (\'note-act-source\')', ], "request": { @@ -1517,9 +1517,8 @@ snapshots["test_api_destroy[RoleViewSet] 1"] = { "queries": [ 'SELECT "emeis_core_role"."created_at", "emeis_core_role"."modified_at", "emeis_core_role"."created_by_user_id", "emeis_core_role"."meta", "emeis_core_role"."slug", "emeis_core_role"."name", "emeis_core_role"."description" FROM "emeis_core_role" WHERE "emeis_core_role"."slug" = \'note-act-source\'', - 'SELECT "emeis_core_role_permissions"."id", "emeis_core_role_permissions"."role_id", "emeis_core_role_permissions"."permission_id" FROM "emeis_core_role_permissions" WHERE "emeis_core_role_permissions"."role_id" IN (\'note-act-source\')', - 'SELECT "emeis_core_acl"."created_at", "emeis_core_acl"."modified_at", "emeis_core_acl"."created_by_user_id", "emeis_core_acl"."meta", "emeis_core_acl"."id", "emeis_core_acl"."user_id", "emeis_core_acl"."scope_id", "emeis_core_acl"."role_id" FROM "emeis_core_acl" WHERE "emeis_core_acl"."role_id" IN (\'note-act-source\')', - 'DELETE FROM "emeis_core_role_permissions" WHERE "emeis_core_role_permissions"."id" IN (1)', + 'DELETE FROM "emeis_core_role_permissions" WHERE "emeis_core_role_permissions"."role_id" IN (\'note-act-source\')', + 'DELETE FROM "emeis_core_acl" WHERE "emeis_core_acl"."role_id" IN (\'note-act-source\')', 'DELETE FROM "emeis_core_role" WHERE "emeis_core_role"."slug" IN (\'note-act-source\')', ], "request": { @@ -1548,7 +1547,7 @@ WHERE "tree_id" = 1 AND ("lft" > 2 OR "rght" > 2)""", 'SELECT "emeis_core_scope"."created_at", "emeis_core_scope"."modified_at", "emeis_core_scope"."created_by_user_id", "emeis_core_scope"."meta", "emeis_core_scope"."id", "emeis_core_scope"."name", "emeis_core_scope"."description", "emeis_core_scope"."parent_id", "emeis_core_scope"."lft", "emeis_core_scope"."rght", "emeis_core_scope"."tree_id", "emeis_core_scope"."level" FROM "emeis_core_scope" WHERE "emeis_core_scope"."parent_id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', - 'SELECT "emeis_core_acl"."created_at", "emeis_core_acl"."modified_at", "emeis_core_acl"."created_by_user_id", "emeis_core_acl"."meta", "emeis_core_acl"."id", "emeis_core_acl"."user_id", "emeis_core_acl"."scope_id", "emeis_core_acl"."role_id" FROM "emeis_core_acl" WHERE "emeis_core_acl"."scope_id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', + 'DELETE FROM "emeis_core_acl" WHERE "emeis_core_acl"."scope_id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', 'DELETE FROM "emeis_core_scope" WHERE "emeis_core_scope"."id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', ], "request": { @@ -1568,7 +1567,7 @@ 'SELECT "emeis_core_role"."created_at", "emeis_core_role"."modified_at", "emeis_core_role"."created_by_user_id", "emeis_core_role"."meta", "emeis_core_role"."slug", "emeis_core_role"."name", "emeis_core_role"."description" FROM "emeis_core_role" WHERE "emeis_core_role"."created_by_user_id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid) ORDER BY "emeis_core_role"."slug" ASC', 'SELECT "emeis_core_permission"."created_at", "emeis_core_permission"."modified_at", "emeis_core_permission"."created_by_user_id", "emeis_core_permission"."meta", "emeis_core_permission"."slug", "emeis_core_permission"."name", "emeis_core_permission"."description" FROM "emeis_core_permission" WHERE "emeis_core_permission"."created_by_user_id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', 'SELECT "emeis_core_acl"."created_at", "emeis_core_acl"."modified_at", "emeis_core_acl"."created_by_user_id", "emeis_core_acl"."meta", "emeis_core_acl"."id", "emeis_core_acl"."user_id", "emeis_core_acl"."scope_id", "emeis_core_acl"."role_id" FROM "emeis_core_acl" WHERE "emeis_core_acl"."created_by_user_id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', - 'SELECT "emeis_core_acl"."created_at", "emeis_core_acl"."modified_at", "emeis_core_acl"."created_by_user_id", "emeis_core_acl"."meta", "emeis_core_acl"."id", "emeis_core_acl"."user_id", "emeis_core_acl"."scope_id", "emeis_core_acl"."role_id" FROM "emeis_core_acl" WHERE "emeis_core_acl"."user_id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', + 'DELETE FROM "emeis_core_acl" WHERE "emeis_core_acl"."user_id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', 'DELETE FROM "emeis_core_user" WHERE "emeis_core_user"."id" IN (\'9dd4e461-268c-8034-f5c8-564e155c67a6\'::uuid)', ], "request": { diff --git a/emeis/core/tests/test_views.py b/emeis/core/tests/test_views.py index e7bc081..b98a348 100644 --- a/emeis/core/tests/test_views.py +++ b/emeis/core/tests/test_views.py @@ -123,7 +123,8 @@ def test_scope_search_filter(db, scope_factory, client): url = reverse("scope-list") - response = client.get(url, {"filter[search]": "skop"}) + response = client.get(url, {"filter[search]": "skop"}, HTTP_ACCEPT_LANGUAGE="de") + assert response.status_code == HTTP_200_OK result = response.json() assert len(result["data"]) == 1