From cc16f0ad3ac98d06df7f0d45592c6b5429eaf85b Mon Sep 17 00:00:00 2001 From: Gunther Weissenbaeck Date: Tue, 21 May 2024 22:44:24 +0200 Subject: [PATCH] wrote some tests --- app/aviary/tests.py | 26 +++++++++++++++++++++++++- app/bird/tests.py | 14 +++++++++++++- app/contact/tests.py | 26 +++++++++++++++++++++++++- app/costs/tests.py | 26 +++++++++++++++++++++++++- 4 files changed, 88 insertions(+), 4 deletions(-) diff --git a/app/aviary/tests.py b/app/aviary/tests.py index 7ce503c..683a4c6 100644 --- a/app/aviary/tests.py +++ b/app/aviary/tests.py @@ -1,3 +1,27 @@ from django.test import TestCase -# Create your tests here. + +class AviaryTestCase(TestCase): + def setUp(self): + Aviary.objects.create( + description="Voliere 1", + condition="Offen", + last_ward_round="2021-01-01", + comment="Test", + ) + + def test_aviary_description(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.description, "Voliere 1") + + def test_aviary_condition(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.condition, "Offen") + + def test_aviary_last_ward_round(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.last_ward_round, "2021-01-01") + + def test_aviary_comment(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.comment, "Test") diff --git a/app/bird/tests.py b/app/bird/tests.py index 7ce503c..2125393 100644 --- a/app/bird/tests.py +++ b/app/bird/tests.py @@ -1,3 +1,15 @@ from django.test import TestCase -# Create your tests here. + +class BirdTestCase(TestCase): + def setUp(self): + Bird.objects.create( + name="Vogel 1", + species="Art 1", + aviary=Aviary.objects.create( + description="Voliere 1", + condition="Offen", + last_ward_round="2021-01-01", + comment="Test", + ), + date_of_birth="2020-01-01 diff --git a/app/contact/tests.py b/app/contact/tests.py index 7ce503c..683a4c6 100644 --- a/app/contact/tests.py +++ b/app/contact/tests.py @@ -1,3 +1,27 @@ from django.test import TestCase -# Create your tests here. + +class AviaryTestCase(TestCase): + def setUp(self): + Aviary.objects.create( + description="Voliere 1", + condition="Offen", + last_ward_round="2021-01-01", + comment="Test", + ) + + def test_aviary_description(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.description, "Voliere 1") + + def test_aviary_condition(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.condition, "Offen") + + def test_aviary_last_ward_round(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.last_ward_round, "2021-01-01") + + def test_aviary_comment(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.comment, "Test") diff --git a/app/costs/tests.py b/app/costs/tests.py index 7ce503c..88bbf86 100644 --- a/app/costs/tests.py +++ b/app/costs/tests.py @@ -1,3 +1,27 @@ from django.test import TestCase -# Create your tests here. +# Write costs tests here +class AviaryTestCase(TestCase): + def setUp(self): + Aviary.objects.create( + description="Voliere 1", + condition="Offen", + last_ward_round="2021-01-01", + comment="Test", + ) + + def test_aviary_description(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.description, "Voliere 1") + + def test_aviary_condition(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.condition, "Offen") + + def test_aviary_last_ward_round(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.last_ward_round, "2021-01-01") + + def test_aviary_comment(self): + aviary = Aviary.objects.get(description="Voliere 1") + self.assertEqual(aviary.comment, "Test")