Example #1
0
 def test_credential_roll(self):
     credential = SearchApiKeyCredential(api_key="old_api_key")
     client = SearchIndexClient("endpoint", "index name", credential)
     assert client._headers == {
         "api-key": "old_api_key",
         "Accept": "application/json;odata.metadata=none",
     }
     credential.update_key("new_api_key")
     assert client._headers == {
         "api-key": "new_api_key",
         "Accept": "application/json;odata.metadata=none",
     }
 def test_update_key(self):
     credential = SearchApiKeyCredential("some_key")
     assert credential.api_key == "some_key"
     credential.update_key("new_key")
     assert credential.api_key == "new_key"