Exemplo n.º 1
0
 def test_parse_filter_params_type_fail(self):
     """Test parse of a filter param with type for invalid type."""
     types = ["bad1", "aws_tags"]
     for tag_type in types:
         filter_params = {"resolution": "daily", "time_scope_value": "-10", "time_scope_units": "day", "type": None}
         filter_params["type"] = tag_type
         serializer = OCPFilterSerializer(data=filter_params)
         self.assertFalse(serializer.is_valid())
Exemplo n.º 2
0
 def test_parse_filter_params_type_success(self):
     """Test parse of a filter param with type successfully."""
     types = ["pod", "storage"]
     for tag_type in types:
         filter_params = {"resolution": "daily", "time_scope_value": "-10", "time_scope_units": "day", "type": None}
         filter_params["type"] = tag_type
         serializer = OCPFilterSerializer(data=filter_params)
         self.assertTrue(serializer.is_valid())
Exemplo n.º 3
0
 def test_parse_filter_params_w_project_failure(self):
     """Test parse of a filter param with an invalid project."""
     filter_params = {
         'resolution': 'daily',
         'time_scope_value': '-10',
         'time_scope_units': 'day',
         'project': 3
     }
     serializer = OCPFilterSerializer(data=filter_params)
     self.assertFalse(serializer.is_valid())
Exemplo n.º 4
0
 def test_parse_filter_params_w_project_success(self):
     """Test parse of a filter param with project successfully."""
     filter_params = {
         'resolution': 'daily',
         'time_scope_value': '-10',
         'time_scope_units': 'day',
         'project': 'myproject'
     }
     serializer = OCPFilterSerializer(data=filter_params)
     self.assertTrue(serializer.is_valid())
Exemplo n.º 5
0
 def test_parse_filter_params_w_project_success(self):
     """Test parse of a filter param with project successfully."""
     filter_params = {
         "resolution": "daily",
         "time_scope_value": "-10",
         "time_scope_units": "day",
         "project": "myproject",
     }
     serializer = OCPFilterSerializer(data=filter_params)
     self.assertTrue(serializer.is_valid())
Exemplo n.º 6
0
 def test_parse_filter_params_w_project_failure(self):
     """Test parse of a filter param with an invalid project."""
     filter_params = {
         "resolution": "daily",
         "time_scope_value": "-10",
         "time_scope_units": "day",
         "project": 3
     }
     serializer = OCPFilterSerializer(data=filter_params)
     self.assertFalse(serializer.is_valid())
Exemplo n.º 7
0
 def test_parse_filter_params_type_fail(self):
     """Test parse of a filter param with type for invalid type."""
     types = ['bad1', 'aws_tags']
     for tag_type in types:
         filter_params = {
             'resolution': 'daily',
             'time_scope_value': '-10',
             'time_scope_units': 'day',
             'type': None
         }
         filter_params['type'] = tag_type
         serializer = OCPFilterSerializer(data=filter_params)
         self.assertFalse(serializer.is_valid())
Exemplo n.º 8
0
 def test_parse_filter_params_type_success(self):
     """Test parse of a filter param with type successfully."""
     types = ['pod', 'storage']
     for tag_type in types:
         filter_params = {
             'resolution': 'daily',
             'time_scope_value': '-10',
             'time_scope_units': 'day',
             'type': None
         }
         filter_params['type'] = tag_type
         serializer = OCPFilterSerializer(data=filter_params)
         self.assertTrue(serializer.is_valid())