Skip to content

Commit

Permalink
add tests to check steps data
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Oct 10, 2023
1 parent e65f30d commit 3757c27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 6 additions & 7 deletions lemarche/tenders/migrations/0058_tenderstepsdata.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Generated by Django 4.2.2 on 2023-10-09 12:32
# Generated by Django 4.2.2 on 2023-10-09 13:35

from django.db import migrations, models
import django.utils.timezone
import django_extensions.db.fields
import shortuuid.main
from django.db import migrations, models
from django_extensions.db.fields import ShortUUIDField
from shortuuid import uuid


class Migration(migrations.Migration):

dependencies = [
("tenders", "0057_alter_tender_siae_transactioned"),
]
Expand All @@ -19,11 +18,11 @@ class Migration(migrations.Migration):
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
(
"uuid",
django_extensions.db.fields.ShortUUIDField(
ShortUUIDField(
auto_created=True,
blank=True,
db_index=True,
default=shortuuid.main.ShortUUID.uuid,
default=uuid,
editable=False,
unique=True,
verbose_name="Identifiant UUID",
Expand Down
9 changes: 8 additions & 1 deletion lemarche/www/tenders/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from lemarche.siaes.models import Siae
from lemarche.tenders import constants as tender_constants
from lemarche.tenders.factories import TenderFactory, TenderQuestionFactory
from lemarche.tenders.models import Tender, TenderSiae
from lemarche.tenders.models import Tender, TenderSiae, TenderStepsData
from lemarche.users.factories import UserFactory
from lemarche.users.models import User
from lemarche.www.tenders.views import TenderCreateMultiStepView
Expand Down Expand Up @@ -89,6 +89,13 @@ def _check_every_step(self, tenders_step_data, final_redirect_page: str = revers
current_errors = response.context_data["form"].errors
self.assertEquals(current_errors, {})

# Is the step data stored correctly ?
tender_step_data = TenderStepsData.objects.first()
self.assertEqual(
data_step["tender_create_multi_step_view-current_step"],
tender_step_data.steps_data[-1]["tender_create_multi_step_view-current_step"],
)

def test_anyone_can_access_create_tender(self):
# anonymous
url = reverse("tenders:create")
Expand Down

0 comments on commit 3757c27

Please sign in to comment.