Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Nov 29, 2024
1 parent f5e9c02 commit 2cb8a0d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 44 deletions.
43 changes: 0 additions & 43 deletions src/country_workspace/__monitor__.py

This file was deleted.

1 change: 0 additions & 1 deletion src/country_workspace/compat/admin_extra_buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def confirm_action(
if request.method == "POST":
ret = None
try:
breakpoint()
ret = action(request)
if success_message:
modeladmin.message_user(request, success_message, messages.SUCCESS)
Expand Down
3 changes: 3 additions & 0 deletions tests/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ omit =
*/tests/**
*/migrations/*,
src/country_workspace/management/commands/demo.py
src/country_workspace/management/commands/trigger_error.py
src/country_workspace/security/backends.py
src/country_workspace/versioning/scripts/*
src/country_workspace/contrib/hope/ddt.py
src/country_workspace/cache/ddt.py
*/wsgi.py,


Expand Down
35 changes: 35 additions & 0 deletions tests/admin/test_admin_program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from typing import TYPE_CHECKING

from django.urls import reverse

import pytest
from django_webtest.pytest_plugin import MixinWithInstanceVariables

from country_workspace.models import User

if TYPE_CHECKING:
from testutils.types import CWTestApp

from country_workspace.workspaces.models import CountryProgram


@pytest.fixture()
def program():
from testutils.factories import CountryProgramFactory

return CountryProgramFactory()


@pytest.fixture()
def app(django_app_factory: "MixinWithInstanceVariables") -> "CWTestApp":
django_app = django_app_factory(csrf_checks=False)
yield django_app


def test_program_zap(app, user: "User", program: "CountryProgram"):
base_url = reverse("admin:country_workspace_program_zap", args=[program.pk])
app.set_user(user)
res = app.get(base_url, expect_errors=True)
res = res.form.submit()
res = res.follow()
assert res.status_code == 302

0 comments on commit 2cb8a0d

Please sign in to comment.