Skip to content

Commit

Permalink
Mark code which isn't supposed to be covered by tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jul 5, 2024
1 parent ba8d1ac commit 082ebe8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
7 changes: 2 additions & 5 deletions accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ class Meta(BaseUser.Meta):
def __str__(self):
return self.full_name or self.email

def get_full_name(self):
return str(self)

def get_short_name(self):
return str(self)
get_full_name = __str__
get_short_name = __str__

def save(self, *args, **kwargs):
super().save(*args, **kwargs)
Expand Down
13 changes: 7 additions & 6 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,24 +158,25 @@
GOOGLE_CLIENT_ID = env("GOOGLE_CLIENT_ID")
GOOGLE_CLIENT_SECRET = env("GOOGLE_CLIENT_SECRET")

if SENTRY_DSN := env("SENTRY_DSN"):
if SENTRY_DSN := env("SENTRY_DSN"): # pragma: no cover
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(dsn=SENTRY_DSN, integrations=[DjangoIntegration()])

if DEBUG:
if DEBUG: # pragma: no cover
INTERNAL_IPS = ["127.0.0.1"]
globals().update(django_email_url(env("EMAIL_URL", default="console:")))
else:
globals().update(django_email_url(env("EMAIL_URL", default="smtp:")))

globals().update(
django_email_url(env("EMAIL_URL", default="console:" if DEBUG else "smtp:"))
)

SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
SESSION_COOKIE_HTTPONLY = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin"

if SECURE_SSL_REDIRECT:
if SECURE_SSL_REDIRECT: # pragma: no cover
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
# SECURE_HSTS_SECONDS = 30 * 86400
Expand Down
4 changes: 2 additions & 2 deletions app/templatetags/webpack_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
register = template.Library()


def webpack_assets(entry):
def webpack_assets(entry): # pragma: no cover
base = Path.cwd()
if settings.DEBUG:
base = base / "tmp" / "dev"
Expand All @@ -19,6 +19,6 @@ def webpack_assets(entry):
return mark_safe(assets)


if not settings.DEBUG:
if not settings.DEBUG: # pragma: no branch
webpack_assets = cache(webpack_assets)
register.simple_tag(webpack_assets)
4 changes: 2 additions & 2 deletions app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def file_response(path):
return lambda request: FileResponse(path.open("rb"))
return lambda request: FileResponse(path.open("rb")) # pragma: no cover


urlpatterns = [
Expand All @@ -26,7 +26,7 @@ def file_response(path):
path("", include("projects.urls")),
]

if settings.DEBUG:
if settings.DEBUG: # pragma: no cover
from django.conf.urls.static import static

urlpatterns += [path("__debug__/", include("debug_toolbar.urls"))]
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import speckenv


if __name__ == "__main__":
if __name__ == "__main__": # pragma: no branch
speckenv.read_speckenv()
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")

Expand Down

0 comments on commit 082ebe8

Please sign in to comment.