diff --git a/unisportomat/quiz/fixtures/sports.json b/unisportomat/quiz/fixtures/sports.json new file mode 100644 index 0000000000000000000000000000000000000000..f941796850b903990a16ac8b4c7d822a3a46759b --- /dev/null +++ b/unisportomat/quiz/fixtures/sports.json @@ -0,0 +1,10 @@ +[ + { + "model": "quiz.sport", + "pk": 1, + "fields": { + "name": "Jiu Jitsu", + "url": "http://www.test.de" + } + } +] \ No newline at end of file diff --git a/unisportomat/quiz/tests.py b/unisportomat/quiz/tests.py index a81a66b6fdcbcc184c2c93fc877372cda3002291..3904e0cf307db440b4fba5e6a87669f8869e9ee7 100644 --- a/unisportomat/quiz/tests.py +++ b/unisportomat/quiz/tests.py @@ -188,3 +188,18 @@ class CriterionAndQuestionModelTest(TestCase): Question(text=text, criterion=self.criterion).save() test_question = Question.objects.first() self.assertEqual(test_question.text, text) + + +class FixturesTest(TestCase): + """ + These are the tests for the fixtures in quiz/fixtures. + Fixtures can be used to populate the database which test data. + They can be used in automated tests, but also in development. + """ + fixtures = ["sports.json"] + + def test_sports_created_by_fixture(self): + """ If the 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")