Skip to content

Commit

Permalink
Fix checkbox validator test
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Feb 4, 2025
1 parent 32abdd3 commit be2badd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions rdmo/projects/tests/test_validator_conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

from rest_framework.exceptions import ValidationError as RestFameworkValidationError

from rdmo.options.models import Option

from ..models import Project, Value
from ..serializers.v1 import ValueSerializer
from ..validators import ValueConflictValidator

project_id = 1
attribute_path = attribute__path='individual/single/text'
option_path = 'one_two_three/one'


def test_serializer_create(db):
Expand Down Expand Up @@ -138,12 +141,7 @@ def test_serializer_create_checkbox(db):
attribute__path='individual/collection/checkbox',
collection_index=0
)
value2 = Value.objects.get(
project_id=project_id,
snapshot=None,
attribute__path='individual/collection/checkbox',
collection_index=2
)
option = Option.objects.get(uri_path=option_path)

class MockedRequest:
data = {
Expand All @@ -163,7 +161,7 @@ class MockedView:
'set_prefix': value.set_prefix,
'set_index': value.set_index,
'collection_index': value.collection_index,
'option': value2.option
'option': option.id
}, serializer)


Expand Down

0 comments on commit be2badd

Please sign in to comment.