Skip to content

Commit

Permalink
fix ! black and flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
vitali-yanushchyk-valor committed May 20, 2024
1 parent 1aa2dce commit 6d15898
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/hope_dedup_engine/apps/faces/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

@admin.register(TaskModel)
class TaskModelAdmin(admin.ModelAdmin):

def has_add_permission(self, request: HttpRequest) -> bool:
return False

Expand Down
1 change: 0 additions & 1 deletion src/hope_dedup_engine/apps/security/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class System(models.Model):


class User(SecurityMixin, AbstractUser):

class Meta:
abstract = False

Expand Down
15 changes: 12 additions & 3 deletions src/hope_dedup_engine/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
from copy import copy
from datetime import datetime, timedelta
from threading import local
from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional
from typing import Any, Dict, Iterator, List, Mapping, Optional, Protocol

# TODO: find out what is correct value for this
not_set = None

not_set = object()

class AnyRequest(Protocol):
COOKIES: Mapping[str, Any]


class AnyResponse(Protocol):
def set_cookie(self, name: str, *args: Any) -> None:
pass


class State(local):
request: "AnyRequest|None" = None
request: AnyRequest | None = None
cookies: Dict[str, List[Any]] = {}

def __repr__(self) -> str:
Expand Down
1 change: 0 additions & 1 deletion tests/extras/testutils/factories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


def get_factory_for_model(_model) -> type[TAutoRegisterModelFactory]:

class Meta:
model = _model

Expand Down
3 changes: 2 additions & 1 deletion tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,14 @@ def test_env_raise(mocked_responses):
with pytest.raises(CommandError):
call_command("env", ignore_errors=False, check=True)


def test_upgrade_exception(mocked_responses, environment):
with mock.patch("hope_dedup_engine.apps.core.management.commands.upgrade.call_command") as m:
m.side_effect = Exception
with pytest.raises(SystemExit):
call_command("upgrade")

out = StringIO()
with mock.patch.dict(os.environ, {"ADMIN_EMAIL": "2222", "ADMIN_USER":"admin", **environment}, clear=True):
with mock.patch.dict(os.environ, {"ADMIN_EMAIL": "2222", "ADMIN_USER": "admin", **environment}, clear=True):
with pytest.raises(SystemExit):
call_command("upgrade", stdout=out, check=True, admin_email="")

0 comments on commit 6d15898

Please sign in to comment.