Esempio n. 1
0
 def test_create_or_update_datasource(self, api_key, endpoint, index_name, **kwargs):
     client = SearchIndexerClient(endpoint, AzureKeyCredential(api_key))
     data_source_connection = self._create_data_source_connection()
     created = client.create_data_source_connection(data_source_connection)
     assert len(client.get_data_source_connections()) == 1
     data_source_connection.description = "updated"
     client.create_or_update_data_source_connection(data_source_connection)
     assert len(client.get_data_source_connections()) == 1
     result = client.get_data_source_connection("sample-datasource")
     assert result.name == "sample-datasource"
     assert result.description == "updated"
Esempio n. 2
0
    def test_delete_datasource_string_if_unchanged(self, api_key, endpoint, index_name, **kwargs):
        client = SearchIndexerClient(endpoint, AzureKeyCredential(api_key))
        data_source_connection = self._create_data_source_connection()
        created = client.create_data_source_connection(data_source_connection)
        etag = created.e_tag

        # Now update the data source connection
        data_source_connection.description = "updated"
        client.create_or_update_data_source_connection(data_source_connection)

        # prepare data source connection
        data_source_connection.e_tag = etag # reset to the original data source connection
        with pytest.raises(ValueError):
            client.delete_data_source_connection(data_source_connection.name, match_condition=MatchConditions.IfNotModified)