mirror of
https://github.com/ae-utbm/sith.git
synced 2025-06-08 04:05:22 +00:00
fix promo logo older than promo 10
This commit is contained in:
parent
ad91c8ed4f
commit
ee3646594b
@ -341,8 +341,8 @@ class User(AbstractUser):
|
|||||||
return reverse("core:user_profile", kwargs={"user_id": self.pk})
|
return reverse("core:user_profile", kwargs={"user_id": self.pk})
|
||||||
|
|
||||||
def promo_has_logo(self) -> bool:
|
def promo_has_logo(self) -> bool:
|
||||||
return Path(
|
return (
|
||||||
settings.BASE_DIR / f"core/static/core/img/promo_{self.promo}.png"
|
settings.BASE_DIR / f"core/static/core/img/promo_{self.promo:02d}.png"
|
||||||
).exists()
|
).exists()
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
@ -335,3 +335,10 @@ class TestRedirectMe:
|
|||||||
def test_anonymous_user(self, client: Client):
|
def test_anonymous_user(self, client: Client):
|
||||||
url = reverse("core:user_me_redirect")
|
url = reverse("core:user_me_redirect")
|
||||||
assertRedirects(client.get(url), reverse("core:login", query={"next": url}))
|
assertRedirects(client.get(url), reverse("core:login", query={"next": url}))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("promo", [7, 22])
|
||||||
|
@pytest.mark.django_db
|
||||||
|
def test_promo_has_logo(promo):
|
||||||
|
user = baker.make(User, promo=promo)
|
||||||
|
assert user.promo_has_logo()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user