def test_parse_filter_params_success(self): """Test parse of a filter param successfully.""" filter_params = { 'resolution': 'daily', 'time_scope_value': '-10', 'time_scope_units': 'day' } serializer = FilterSerializer(data=filter_params) self.assertTrue(serializer.is_valid())
def test_parse_filter_params_success(self): """Test parse of a filter param successfully.""" filter_params = { "resolution": "daily", "time_scope_value": "-10", "time_scope_units": "day" } serializer = FilterSerializer(data=filter_params) self.assertTrue(serializer.is_valid())
def test_filter_params_invalid_limit_time_scope_resolution(self): """Test parse of filter params for invalid resolution time_scope_units.""" filter_params = { 'resolution': 'monthly', 'time_scope_value': '-10', 'time_scope_units': 'day' } serializer = FilterSerializer(data=filter_params) with self.assertRaises(serializers.ValidationError): serializer.is_valid(raise_exception=True)
def test_filter_params_invalid_limit_time_scope_resolution(self): """Test parse of filter params for invalid resolution time_scope_units.""" filter_params = { "resolution": "monthly", "time_scope_value": "-10", "time_scope_units": "day" } serializer = FilterSerializer(data=filter_params) with self.assertRaises(serializers.ValidationError): serializer.is_valid(raise_exception=True)
def test_parse_filter_no_params_success(self): """Test parse of a filter param successfully.""" filter_params = {} serializer = FilterSerializer(data=filter_params) self.assertTrue(serializer.is_valid())