コード例 #1
0
ファイル: test_serializers.py プロジェクト: xJustin/koku
 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())
コード例 #2
0
ファイル: test_serializers.py プロジェクト: xJustin/koku
 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)
コード例 #3
0
 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())