def _assert_properties_default(self, prop): self.assertIsNotNone(prop) self._assert_logging_equal(prop.logging, Logging()) self._assert_metrics_equal(prop.hour_metrics, Metrics()) self._assert_metrics_equal(prop.minute_metrics, Metrics()) self._assert_cors_equal(prop.cors, list())
def test_table_service_properties(self): # Arrange # Act resp = self.ts.set_table_service_properties(logging=Logging(), hour_metrics=Metrics(), minute_metrics=Metrics(), cors=list()) # Assert self.assertIsNone(resp) self._assert_properties_default(self.ts.get_table_service_properties())
def test_set_logging(self): # Arrange logging = Logging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act self.bs.set_blob_service_properties(logging=logging) # Assert received_props = self.bs.get_blob_service_properties() self._assert_logging_equal(received_props.logging, logging)
def test_blob_service_properties(self): # Arrange # Act resp = self.bs.set_blob_service_properties(logging=Logging(), hour_metrics=Metrics(), minute_metrics=Metrics(), cors=list(), target_version='2014-02-14') # Assert self.assertIsNone(resp) props = self.bs.get_blob_service_properties() self._assert_properties_default(props) self.assertEqual('2014-02-14', props.target_version)
def service_properties(self): # Basic self.service.set_queue_service_properties( logging=Logging(delete=True), hour_metrics=Metrics(enabled=True, include_apis=True), minute_metrics=Metrics(enabled=True, include_apis=False), cors=[CorsRule(allowed_origins=['*'], allowed_methods=['GET'])]) # Wait 30 seconds for settings to propagate time.sleep(30) props = self.service.get_queue_service_properties( ) # props = ServiceProperties() w/ all properties specified above # Omitted properties will not overwrite what's already on the self.service # Empty properties will clear self.service.set_queue_service_properties(cors=[]) # Wait 30 seconds for settings to propagate time.sleep(30) props = self.service.get_queue_service_properties( ) # props = ServiceProperties() w/ CORS rules cleared