def test_serializer_outputs_expected_schema_for_addon_experiment(self): experiment = ExperimentFactory.create_with_status( Experiment.STATUS_SHIP, type=Experiment.TYPE_ADDON, locales=[LocaleFactory.create()], countries=[CountryFactory.create()], ) serializer = ExperimentRecipeSerializer(experiment) self.assertEqual(serializer.data["action_name"], "opt-out-study") self.assertEqual(serializer.data["name"], experiment.name) self.assertEqual(serializer.data["comment"], experiment.client_matching) self.assertEqual( serializer.data["filter_object"], [ FilterObjectBucketSampleSerializer(experiment).data, FilterObjectChannelSerializer(experiment).data, FilterObjectVersionsSerializer(experiment).data, FilterObjectLocaleSerializer(experiment).data, FilterObjectCountrySerializer(experiment).data, ], ) self.assertEqual( serializer.data["arguments"], ExperimentRecipeAddonArgumentsSerializer(experiment).data, )
def test_serializer_outputs_version_string_with_range(self): experiment = ExperimentFactory.create(firefox_min_version="68.0", firefox_max_version="70.0") serializer = FilterObjectVersionsSerializer(experiment) self.assertEqual(serializer.data, { "type": "version", "versions": [68, 69, 70] })