Fix tests

This commit is contained in:
2024-12-11 22:37:26 +01:00
parent d12dd7678b
commit b0966e7664
7 changed files with 3 additions and 144 deletions

View File

@ -18,7 +18,7 @@ logger: logging.Logger = logging.getLogger(__name__)
class User(AbstractUser):
"""Custom user model."""
class Meta(auto_prefetch.Model.Meta):
class Meta:
ordering: ClassVar[list[str]] = ["username"]
def __str__(self) -> str:

View File

@ -3,76 +3,6 @@
{% block content %}
<div class="container mt-4">
{% include "partials/info_box.html" %}
{% include "partials/news.html" %}
<!-- Reward Campaigns Section -->
<section class="reward-campaigns">
<h2>
Reward Campaigns -
<span class="d-inline text-muted">{{ reward_campaigns.count }} campaign{{ reward_campaigns.count|pluralize }}</span>
</h2>
<!-- Loop through reward campaigns -->
{% for campaign in reward_campaigns %}
<div class="card mb-4 shadow-sm" id="campaign-{{ campaign.twitch_id }}">
<div class="row g-0">
<!-- Campaign Image -->
<div class="col-md-2">
<img src="{{ campaign.image_url }}"
alt="{{ campaign.name }}"
class="img-fluid rounded-start"
height="283"
width="212"
loading="lazy" />
</div>
<!-- Campaign Details -->
<div class="col-md-10">
<div class="card-body">
<h2 class="card-title h5">
<a href="#campaign-{{ campaign.twitch_id }}" class="plain-text-item">{{ campaign.name }}</a>
</h2>
<p class="card-text text-muted">{{ campaign.summary }}</p>
<p class="mb-2 text-muted">
Ends in:
<abbr title="{{ campaign.starts_at|date:'l d F H:i %Z' }} - {{ campaign.ends_at|date:'l d F H:i %Z' }}">
{{ campaign.ends_at|timesince }}
</abbr>
</p>
<a href="{{ campaign.external_url }}"
class="btn btn-primary"
target="_blank">Learn More</a>
<!-- Instructions (if any) -->
{% if campaign.instructions %}
<div class="mt-3">
<h3 class="h6">Instructions</h3>
<p>{{ campaign.instructions|safe }}</p>
</div>
{% endif %}
<!-- Rewards (if any) -->
{% if campaign.rewards.all %}
<div class="mt-3">
<h3 class="h6">Rewards</h3>
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-2">
{% for reward in campaign.rewards.all %}
<div class="col d-flex align-items-center position-relative">
<img src="{{ reward.thumbnail_image_url }}"
alt="{{ reward.name }} reward image"
class="img-fluid rounded me-3"
height="50"
width="50"
loading="lazy" />
<div>
<strong>{{ reward.name }}</strong>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
</section>
<!-- Drop Campaigns Section -->
<section class="drop-campaigns">
<h2>

View File

@ -7,18 +7,12 @@
<li class="nav-item">
<a class="nav-link" href='{% url "games" %}'>Games</a>
</li>
<li>
<a class="nav-link" href='{% url "reward_campaigns" %}'>Reward campaigns</a>
</li>
<li class="nav-item">
<a class="nav-link" href=''>API</a>
</li>
<li class="nav-item d-none d-sm-block">
<a class="nav-link" href="https://github.com/sponsors/TheLovinator1">Donate</a>
</li>
<li class="nav-item d-none d-sm-block">
<a class="nav-link" href='{% url "webhooks" %}'>Webhooks</a>
</li>
</ul>
</nav>
</header>

View File

@ -1,53 +0,0 @@
{% if webhooks %}
<div class="card mb-4 shadow-sm" id="info-box">
<div class="row g-0">
<div class="col-md-10">
<div class="card-body">
<h2 class="card-title h2">Site news</h2>
<div class="mt-auto">
{% for webhook in webhooks %}
<div class="mt-3">
<img src="{{ webhook.avatar }}?size=32"
alt="{{ webhook.name }}"
class="rounded-circle"
height="32"
width="32" />
<a href="{{ webhook.url }}" target="_blank">{{ webhook.name }}</a>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="new-drop-switch-daily" />
<label class="form-check-label" for="new-drop-switch-daily">
Daily notification of newly
added games to TTVdrops
</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="new-drop-switch-weekly" />
<label class="form-check-label" for="new-drop-switch-weekly">
Weekly notification of newly added games to TTVdrops
</label>
</div>
<br />
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="new-org-switch-daily" />
<label class="form-check-label" for="new-org-switch-daily">
Daily notification of newly added <abbr title="Organizations are the companies that own the games.">organizations</abbr> to
TTVdrops
</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="new-org-switch-weekly" />
<label class="form-check-label" for="new-org-switch-weekly">
Weekly notification of newly added <abbr title="Organizations are the companies that own the games.">organizations</abbr> to
TTVdrops
</label>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
{% else %}
<p class="text-muted">No webhooks added yet.</p>
{% endif %}

View File

@ -1,12 +0,0 @@
{% extends "base.html" %}
{% load campaign_tags game_tags static %}
{% block content %}
<div class="container mt-4">
<div class="row">
<h2>Reward Campaigns</h2>
{% for campaign in reward_campaigns %}
{% render_campaign campaign %}
{% endfor %}
</div>
</div>
{% endblock content %}

View File

@ -16,7 +16,7 @@ if TYPE_CHECKING:
@pytest.mark.django_db
def test_index_view(client: Client) -> None:
"""Test index view."""
url: str = reverse(viewname="core:index")
url: str = reverse(viewname="index")
response: _MonkeyPatchedWSGIResponse = client.get(url)
assert isinstance(response, HttpResponse)