Esempio n. 1
0
 def test_preference_exeriments_unique_branch_values(self):
     action = ActionFactory(name='preference-experiment')
     arguments = {
         'slug':
         'test',
         'branches': [{
             'slug': 'a',
             'value': 'unique'
         }, {
             'slug': 'b',
             'value': 'duplicate'
         }, {
             'slug': 'c',
             'value': 'duplicate'
         }]
     }
     with pytest.raises(serializers.ValidationError) as exc_info:
         action.validate_arguments(arguments)
     error = action.errors['duplicate_branch_value']
     assert exc_info.value.detail == {
         'arguments': {
             'branches': {
                 2: {
                     'value': error
                 }
             }
         }
     }
Esempio n. 2
0
 def test_preference_experiments_unique_branch_values(self):
     action = ActionFactory(name="preference-experiment")
     arguments = {
         "slug":
         "test",
         "branches": [
             {
                 "slug": "a",
                 "value": "unique"
             },
             {
                 "slug": "b",
                 "value": "duplicate"
             },
             {
                 "slug": "c",
                 "value": "duplicate"
             },
         ],
     }
     with pytest.raises(serializers.ValidationError) as exc_info:
         action.validate_arguments(arguments, RecipeRevisionFactory())
     error = action.errors["duplicate_branch_value"]
     assert exc_info.value.detail == {
         "arguments": {
             "branches": {
                 2: {
                     "value": error
                 }
             }
         }
     }
Esempio n. 3
0
 def test_unique_branch_slugs(self):
     action = ActionFactory(name="multi-preference-experiment")
     arguments = MultiPreferenceExperimentArgumentsFactory(
         branches=[{"slug": "unique"}, {"slug": "duplicate"}, {"slug": "duplicate"}],
     )
     with pytest.raises(serializers.ValidationError) as exc_info:
         action.validate_arguments(arguments, RecipeRevisionFactory())
     error = action.errors["duplicate_branch_slug"]
     assert exc_info.value.detail == {"arguments": {"branches": {2: {"slug": error}}}}
Esempio n. 4
0
 def test_preference_exeriments_unique_branch_values(self):
     action = ActionFactory(name="preference-experiment")
     arguments = {
         "slug": "test",
         "branches": [
             {"slug": "a", "value": "unique"},
             {"slug": "b", "value": "duplicate"},
             {"slug": "c", "value": "duplicate"},
         ],
     }
     with pytest.raises(serializers.ValidationError) as exc_info:
         action.validate_arguments(arguments, RecipeRevisionFactory())
     error = action.errors["duplicate_branch_value"]
     assert exc_info.value.detail == {"arguments": {"branches": {2: {"value": error}}}}
Esempio n. 5
0
 def test_it_works(self):
     action = ActionFactory(name="nothing special")
     # does not raise an exception
     action.validate_arguments({}, RecipeRevisionFactory())
Esempio n. 6
0
 def test_it_works(self):
     action = ActionFactory(name="nothing special")
     # does not raise an exception
     action.validate_arguments({}, RecipeRevisionFactory())
Esempio n. 7
0
 def test_it_works(self):
     action = ActionFactory(name='nothing special')
     # does not raise an exception
     action.validate_arguments({})