From 204a71d3f487af726be883505adb906f47f68b3e Mon Sep 17 00:00:00 2001 From: muhuchah Date: Sat, 8 Jun 2024 18:34:59 +0330 Subject: [PATCH] Add Generate city to liara.yaml --- .github/workflows/liara.yaml | 6 ++++++ Karoo_BackEnd/Karoo_BackEnd/support/tests/test_models.py | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/liara.yaml b/.github/workflows/liara.yaml index 694872f..d5fc47b 100644 --- a/.github/workflows/liara.yaml +++ b/.github/workflows/liara.yaml @@ -27,6 +27,12 @@ jobs: source venv/bin/activate pip install -r requirements.txt + - name: Generate City + working-directory: Karoo_BackEnd/Karoo_BackEnd + run: | + source venv/bin/activate + python manage.py generate_city + - name: Run Django migrations working-directory: Karoo_BackEnd/Karoo_BackEnd run: | diff --git a/Karoo_BackEnd/Karoo_BackEnd/support/tests/test_models.py b/Karoo_BackEnd/Karoo_BackEnd/support/tests/test_models.py index 98d62b6..58ed1a9 100644 --- a/Karoo_BackEnd/Karoo_BackEnd/support/tests/test_models.py +++ b/Karoo_BackEnd/Karoo_BackEnd/support/tests/test_models.py @@ -6,7 +6,6 @@ from account_module.models import User, Province, City from category_module.models import MainCategory, SubCategory from model_bakery import baker -from django.core.management import call_command class SpamReportModelTest(TestCase): def setUp(self): @@ -19,9 +18,8 @@ def setUp(self): self.main_category = baker.make(MainCategory) self.sub_category = baker.make(SubCategory, MainCategory=self.main_category) - call_command('generate_city') - self.province = Province.objects.get(id=1) - self.city = City.objects.get(id=1) + self.province = baker.make(Province) + self.city = baker.make(City, province=self.province) self.job = job.objects.create( user = self.user,