diff --git a/unisportomat/media/logo.png b/unisportomat/media/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..28ab70d2a640f9b429f12a6ae73e5dca72fd95ef Binary files /dev/null and b/unisportomat/media/logo.png differ diff --git a/unisportomat/media/test_image.png b/unisportomat/media/test_image.png new file mode 100644 index 0000000000000000000000000000000000000000..6bc0d74c8d2d1dcc063ab7e782a42dbcf466664d Binary files /dev/null and b/unisportomat/media/test_image.png differ diff --git a/unisportomat/quiz/fixtures/calls_to_move.json b/unisportomat/quiz/fixtures/calls_to_move.json new file mode 100644 index 0000000000000000000000000000000000000000..acb39dd05c2ed062d9bd6eac922e35c5f1de8291 --- /dev/null +++ b/unisportomat/quiz/fixtures/calls_to_move.json @@ -0,0 +1,10 @@ +[ + { + "model": "quiz.calltomove", + "pk": 1, + "fields": { + "text": "Kreise deine Arme vor der nächsten Frage 3x nach hinten", + "image": "test_image.png" + } + } +] \ No newline at end of file diff --git a/unisportomat/quiz/fixtures/criteria.json b/unisportomat/quiz/fixtures/criteria.json new file mode 100644 index 0000000000000000000000000000000000000000..584ded6433489d92a803179cea13f8313434e63b --- /dev/null +++ b/unisportomat/quiz/fixtures/criteria.json @@ -0,0 +1,9 @@ +[ + { + "model": "quiz.criterion", + "pk": 1, + "fields": { + "name": "Outdoorsport" + } + } +] \ No newline at end of file diff --git a/unisportomat/quiz/fixtures/criterion_ratings.json b/unisportomat/quiz/fixtures/criterion_ratings.json new file mode 100644 index 0000000000000000000000000000000000000000..3e27200ccc25d663003d4d5f20af160006f4101b --- /dev/null +++ b/unisportomat/quiz/fixtures/criterion_ratings.json @@ -0,0 +1,11 @@ +[ + { + "model": "quiz.criterionrating", + "pk": 1, + "fields": { + "rating": 1, + "criterion": 1, + "sport": 1 + } + } +] \ No newline at end of file diff --git a/unisportomat/quiz/fixtures/images/logo.png b/unisportomat/quiz/fixtures/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..28ab70d2a640f9b429f12a6ae73e5dca72fd95ef Binary files /dev/null and b/unisportomat/quiz/fixtures/images/logo.png differ diff --git a/unisportomat/quiz/fixtures/knowledge_snacks.json b/unisportomat/quiz/fixtures/knowledge_snacks.json new file mode 100644 index 0000000000000000000000000000000000000000..8b0e3045e3e312b3424579f5618832135f70c998 --- /dev/null +++ b/unisportomat/quiz/fixtures/knowledge_snacks.json @@ -0,0 +1,10 @@ +[ + { + "model": "quiz.knowledgesnack", + "pk": 1, + "fields": { + "text": "Dass Treppensteigen fast 5x so viele Kalorien verbrennt, als die Nutzung des Aufzuges?", + "image": "logo.png" + } + } +] \ No newline at end of file diff --git a/unisportomat/quiz/fixtures/questions.json b/unisportomat/quiz/fixtures/questions.json new file mode 100644 index 0000000000000000000000000000000000000000..d9f455362e4cdbc5858d96e4a0dc1cc95e83079a --- /dev/null +++ b/unisportomat/quiz/fixtures/questions.json @@ -0,0 +1,9 @@ +[ + { + "model": "quiz.question", + "pk": 1, + "fields": { + "text": "Ich mache am liebsten draußen Sport" + } + } +] \ No newline at end of file diff --git a/unisportomat/quiz/tests.py b/unisportomat/quiz/tests.py index d35b4eabfc26a4ac03b81f3eb4af35bc62caa90f..642c68331cb0c96d04a83364247ec6e412930f86 100644 --- a/unisportomat/quiz/tests.py +++ b/unisportomat/quiz/tests.py @@ -197,10 +197,55 @@ class FixturesTest(TestCase): They can be used in automated tests, but also in development. """ - fixtures = ["sports.json"] + fixtures = [ + "sports.json", + "criteria.json", + "criterion_ratings.json", + "questions.json", + "calls_to_move.json", + "knowledge_snacks.json", + ] def test_sports_created_by_fixture(self): - """If the fixture is loaded there exists a sport with the given data.""" + """If the sports fixture is loaded there exists a sport with the given data.""" sport = Sport.objects.get(pk=1) self.assertEqual(sport.name, "Jiu Jitsu") self.assertEqual(sport.url, "http://www.test.de") + + def test_criterion_created_by_fixture(self): + """If the criteria fixture is loaded there exists a criterion with the given data""" + criterion = Criterion.objects.get(pk=1) + self.assertEqual(criterion.name, "Outdoorsport") + + def test_criterion_rating_created_by_fixture(self): + """If the criterion_ratings fixture is loaded the given sport has a corresponding rating""" + criterion = Criterion.objects.get(name="Outdoorsport") + sport = Sport.objects.get(name="Jiu Jitsu") + self.assertEqual(sport.get_rating(criterion), 1) + + def test_question_created_by_fixture(self): + """If the questions fixture is loaded there exists a question with the given data""" + question = Question.objects.get(pk=1) + criterion = Criterion.objects.get(name="Outdoorsport") + self.assertEqual(question.text, "Ich mache am liebsten draußen Sport") + self.assertEqual(question.criterion, criterion) + + def test_call_to_move_created_by_fixture(self): + """If the call to move fixture is loaded there exists a call to move with the given data""" + call_to_move = CallToMove.objects.get(pk=1) + self.assertEqual( + call_to_move.text, "Kreise deine Arme vor der nächsten Frage 3x nach hinten" + ) + self.assertEqual(call_to_move.image.name, "test_image.png") + + def test_knowledge_snack_created_by_fixture(self): + """ + If the knowledge snack fixture is loaded there exists a knowledge snack with the given data + """ + knowledge_snack = KnowledgeSnack.objects.get(pk=1) + self.assertEqual( + knowledge_snack.text, + "Dass Treppensteigen fast 5x so viele Kalorien verbrennt, " + "als die Nutzung des Aufzuges?", + ) + self.assertEqual(knowledge_snack.image.name, "logo.png")