-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pick-smaller-changes-from-app-restructure
- Loading branch information
Showing
23 changed files
with
450 additions
and
48 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
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 |
---|---|---|
|
@@ -255,3 +255,4 @@ $RECYCLE.BIN/ | |
*.sqlite3 | ||
*.db | ||
.vim | ||
src/publicmedia |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,46 @@ | ||
# Create your tests here. | ||
from django.urls import reverse | ||
from rest_framework.test import APITestCase | ||
from config import config | ||
|
||
from team.tests import TeamSetupMixin | ||
from requests.exceptions import ConnectionError | ||
|
||
|
||
class AndromedaTestCase(TeamSetupMixin, APITestCase): | ||
def test_get_instance_disabled_challenge_server(self): | ||
with self.settings( | ||
CHALLENGE_SERVER_ENABLED=False, | ||
): | ||
self.client.force_authenticate(user=self.user) | ||
response = self.client.get(reverse("get-instance", args=["1"])) | ||
self.assertContains(response, "challenge_server_disabled", status_code=403) | ||
|
||
def test_request_new_instance_disabled_challenge_server(self): | ||
with self.settings( | ||
CHALLENGE_SERVER_ENABLED=False, | ||
): | ||
self.client.force_authenticate(user=self.user) | ||
response = self.client.get(reverse("request-new-instance", args=["1"])) | ||
self.assertContains(response, "challenge_server_disabled", status_code=403) | ||
|
||
def test_get_instance_no_team(self): | ||
with self.settings( | ||
CHALLENGE_SERVER_ENABLED=True, | ||
): | ||
self.client.force_authenticate(user=self.user) | ||
config.set("enable_team_leave", True) | ||
self.client.post(reverse("team-leave")) | ||
response = self.client.get(reverse("get-instance", args=["1"])) | ||
self.assertContains(response, "challenge_server_team_required", status_code=403) | ||
|
||
def test_get_instance(self): | ||
# This is a bad test but we need a stub service | ||
with self.settings( | ||
CHALLENGE_SERVER_ENABLED=True, | ||
ANDROMEDA_URL="http://andromeda", | ||
ANDROMEDA_API_KEY="andromeda", | ||
ANDROMEDA_TIMEOUT=0.1, | ||
): | ||
with self.assertRaises(ConnectionError): | ||
self.client.force_authenticate(user=self.user) | ||
self.client.get(reverse("get-instance", args=["1"])) |
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,18 @@ | ||
# Generated by Django 4.0.2 on 2022-02-26 20:13 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('challenge', '0021_challenge_maintenance'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='challenge', | ||
name='current_score', | ||
field=models.IntegerField(help_text='The dynamically updated score for this challenge, null if the challenge is statically scored.', null=True), | ||
), | ||
] |
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
Oops, something went wrong.