def test_set_cors(self, datalake_storage_account_name, datalake_storage_account_key): self._setUp(datalake_storage_account_name, datalake_storage_account_key) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] allowed_methods = ['GET', 'PUT'] max_age_in_seconds = 500 exposed_headers = [ "x-ms-meta-data*", "x-ms-meta-source*", "x-ms-meta-abc", "x-ms-meta-bcd" ] allowed_headers = [ "x-ms-meta-data*", "x-ms-meta-target*", "x-ms-meta-xyz", "x-ms-meta-foo" ] cors_rule2 = CorsRule(allowed_origins, allowed_methods, max_age_in_seconds=max_age_in_seconds, exposed_headers=exposed_headers, allowed_headers=allowed_headers) cors = [cors_rule1, cors_rule2] # Act self.dsc.set_service_properties(cors=cors) # Assert received_props = self.dsc.get_service_properties() self._assert_cors_equal(received_props['cors'], cors)
def test_set_static_website_props_dont_impact_other_props( self, datalake_storage_account_name, datalake_storage_account_key): self._setUp(datalake_storage_account_name, datalake_storage_account_key) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] allowed_methods = ['GET', 'PUT'] max_age_in_seconds = 500 exposed_headers = [ "x-ms-meta-data*", "x-ms-meta-source*", "x-ms-meta-abc", "x-ms-meta-bcd" ] allowed_headers = [ "x-ms-meta-data*", "x-ms-meta-target*", "x-ms-meta-xyz", "x-ms-meta-foo" ] cors_rule2 = CorsRule(allowed_origins, allowed_methods, max_age_in_seconds=max_age_in_seconds, exposed_headers=exposed_headers, allowed_headers=allowed_headers) cors = [cors_rule1, cors_rule2] # Act to set cors self.dsc.set_service_properties(cors=cors) # Assert cors is updated received_props = self.dsc.get_service_properties() self._assert_cors_equal(received_props['cors'], cors) # Arrange to set static website properties static_website = StaticWebsite( enabled=True, index_document="index.html", error_document404_path="errors/error/404error.html") # Act to set static website self.dsc.set_service_properties(static_website=static_website) # Assert static website was updated was cors was unchanged received_props = self.dsc.get_service_properties() self._assert_static_website_equal(received_props['static_website'], static_website) self._assert_cors_equal(received_props['cors'], cors)