Example #1
0
 def test_specific_account(self):
     """Test that execute_query() succeeds with account parameter."""
     url = f"?filter[time_scope_units]=day&filter[time_scope_value]=-10&filter[resolution]=daily&filter[account]={str(self.fake.ean8())}"  # noqa: E501
     query_params = self.mocked_query_params(url, OCPAWSTagView)
     handler = OCPAWSTagQueryHandler(query_params)
     query_output = handler.execute_query()
     self.assertIsNotNone(query_output.get("data"))
     self.assertEqual(handler.time_scope_units, "day")
     self.assertEqual(handler.time_scope_value, -10)
Example #2
0
 def test_last_month(self):
     """Test that execute_query() succeeds with last-month parameters."""
     url = "?filter[time_scope_units]=month&filter[time_scope_value]=-2&filter[resolution]=monthly"
     query_params = self.mocked_query_params(url, OCPAWSTagView)
     handler = OCPAWSTagQueryHandler(query_params)
     query_output = handler.execute_query()
     self.assertIsNotNone(query_output.get("data"))
     self.assertEqual(handler.time_scope_units, "month")
     self.assertEqual(handler.time_scope_value, -2)
Example #3
0
 def test_30_day(self):
     """Test that execute_query() succeeds with 30 day parameters."""
     url = "?filter[time_scope_units]=day&filter[time_scope_value]=-30&filter[resolution]=daily"  # noqa: E501
     query_params = self.mocked_query_params(url, OCPAWSTagView)
     handler = OCPAWSTagQueryHandler(query_params)
     query_output = handler.execute_query()
     self.assertIsNotNone(query_output.get("data"))
     self.assertEqual(handler.time_scope_units, "day")
     self.assertEqual(handler.time_scope_value, -30)
Example #4
0
 def test_no_parameters(self):
     """Test that the execute_query() succeeds with no parameters."""
     url = "?"
     query_params = self.mocked_query_params(url, OCPAWSTagView)
     handler = OCPAWSTagQueryHandler(query_params)
     query_output = handler.execute_query()
     self.assertIsNotNone(query_output.get("data"))
     self.assertEqual(handler.time_scope_units, "day")
     self.assertEqual(handler.time_scope_value, -10)
Example #5
0
 def test_10_day_only_keys(self):
     """Test that execute_query() succeeds with 10 day parameters, keys-only."""
     url = (
         "?filter[time_scope_units]=day&filter[time_scope_value]=-10&filter[resolution]=daily&key_only=True"
     )  # noqa: E501
     query_params = self.mocked_query_params(url, OCPAWSTagView)
     handler = OCPAWSTagQueryHandler(query_params)
     query_output = handler.execute_query()
     self.assertIsNotNone(query_output.get("data"))
     self.assertEqual(handler.time_scope_units, "day")
     self.assertEqual(handler.time_scope_value, -10)