-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into upgrading-next.js
- Loading branch information
Showing
32 changed files
with
459 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,46 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: pip | ||
directory: "/pip" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
# Python dependencies | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
|
||
# Frontend dependencies (security update grouped) | ||
- package-ecosystem: "npm" | ||
directory: "/frontend" | ||
schedule: | ||
interval: "daily" | ||
open-pull-requests-limit: 10 | ||
allow: | ||
- dependency-name: "*" | ||
ignore: | ||
- dependency-name: "*" | ||
update-types: | ||
- "version-update:semver-major" | ||
- "version-update:semver-minor" | ||
- "version-update:semver-patch" | ||
|
||
# Frontend dependencies (security updates grouped) | ||
# - package-ecosystem: npm | ||
# directory: "/frontend" | ||
# schedule: | ||
# interval: daily | ||
# open-pull-requests-limit: 0 | ||
|
||
# Frontend dependencies all updates grouped by major/minor | ||
# - package-ecosystem: npm | ||
# directory: "/frontend" | ||
# schedule: | ||
# interval: daily | ||
# open-pull-requests-limit: 10 | ||
# groups: | ||
# minor-and-patch: | ||
# update-types: | ||
# - "minor" | ||
# - "patch" | ||
|
||
# major-updates: | ||
# update-types: | ||
# - "major" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
|
||
from rest_framework.test import APIClient | ||
|
||
from aiarena.core.tests.test_mixins import MatchReadyMixin | ||
|
||
|
||
class BotSerializerTestCase(MatchReadyMixin, TestCase): | ||
def test_download_bot_zip_success(self): | ||
""" | ||
Note that this test is for essentially a defunct feature. Downloads would be via AWS S3. | ||
""" | ||
self.client = APIClient() | ||
self.client.force_authenticate(user=self.regularUser1) | ||
bot = self.regularUser1Bot1 # owned by the current user | ||
|
||
# URL base name for BotViewSet is api_bot, action url_path is zip | ||
self.url = reverse("api_bot-download-zip", kwargs={"pk": bot.id}) | ||
response = self.client.get(self.url) | ||
self.assertEqual(response.status_code, 200) | ||
|
||
def test_download_bot_zip_unauthorized(self): | ||
""" | ||
Note that this test is for essentially a defunct feature. Downloads would be via AWS S3. | ||
""" | ||
self.client = APIClient() | ||
self.client.force_authenticate(user=self.regularUser1) | ||
bot = self.staffUser1Bot1 # owned by someone else | ||
|
||
# URL base name for BotViewSet is api_bot, action url_path is zip | ||
self.url = reverse("api_bot-download-zip", kwargs={"pk": bot.id}) | ||
response = self.client.get(self.url) | ||
self.assertEqual(response.status_code, 404) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
from django.contrib.auth import get_user_model | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
|
||
from rest_framework import status | ||
from rest_framework.test import APIClient | ||
|
||
from aiarena.core.models import Map, Match | ||
from aiarena.core.tests.test_mixins import MatchReadyMixin | ||
|
||
|
||
User = get_user_model() | ||
|
||
|
||
class MatchRequestsViewSetTests(MatchReadyMixin, TestCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.client = APIClient() | ||
self.client.force_authenticate(user=self.regularUser1) | ||
|
||
# Create test map | ||
self.test_map = Map.objects.first() | ||
|
||
self.url = reverse("api_request_match-request-single") | ||
|
||
def test_request_match_failure_not_supporter(self): | ||
"""Test match request failure - user is not a supporter""" | ||
user = self.staffUser1 | ||
user.patreon_level = "none" | ||
response = self.request_match(user) | ||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | ||
self.assertEqual(Match.objects.count(), 0) | ||
|
||
def test_request_match_success_supporter(self): | ||
"""Test match request successful - user is a supporter""" | ||
user = self.staffUser1 | ||
user.patreon_level = "bronze" | ||
response = self.request_match(user) | ||
|
||
self.assertEqual(response.status_code, status.HTTP_201_CREATED) | ||
self.assertIn("match_id", response.data) | ||
self.assertEqual(Match.objects.count(), 1) | ||
match = Match.objects.first() | ||
self.assertEqual(match.requested_by, User.objects.get(id=user.id)) | ||
self.assertEqual(match.map, self.test_map) | ||
|
||
def request_match(self, user): | ||
data = { | ||
"bot1": self.regularUser1Bot1.id, | ||
"bot2": self.regularUser1Bot2.id, | ||
"map": self.test_map.id, | ||
} | ||
self.client.force_authenticate(user=user) | ||
return self.client.post(self.url, data, format="json") | ||
|
||
def test_request_match_invalid_bot(self): | ||
"""Test match request with invalid bot ID""" | ||
data = { | ||
"bot1": 99999, # Non-existent bot ID | ||
"bot2": self.regularUser1Bot2.id, | ||
} | ||
|
||
user = self.staffUser1 | ||
user.patreon_level = "bronze" | ||
self.client.force_authenticate(user=user) | ||
response = self.client.post(self.url, data, format="json") | ||
|
||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
self.assertEqual(Match.objects.count(), 0) | ||
|
||
def test_request_match_unauthenticated(self): | ||
"""Test match request without authentication""" | ||
self.client.force_authenticate(user=None) | ||
|
||
data = { | ||
"bot1": self.regularUser1Bot1.id, | ||
"bot2": self.regularUser1Bot2.id, | ||
} | ||
|
||
response = self.client.post(self.url, data, format="json") | ||
|
||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | ||
self.assertEqual(Match.objects.count(), 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.16 on 2024-12-08 15:28 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0078_remove_user_can_request_games_for_another_authors_bot"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="game", | ||
name="map_file_extension", | ||
field=models.CharField(default=".SC2Map", max_length=20), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.