def test_upsert_document_default(self, mock_cosmos): test_id = str(uuid.uuid4()) # fmt: off (mock_cosmos .return_value .get_database_client .return_value .get_container_client .return_value .upsert_item .return_value) = {'id': test_id} # fmt: on hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') returned_item = hook.upsert_document({'id': test_id}) expected_calls = [ mock.call() .get_database_client('test_database_name') .get_container_client('test_collection_name') .upsert_item({'id': test_id}) ] mock_cosmos.assert_any_call(self.test_end_point, {'masterKey': self.test_master_key}) mock_cosmos.assert_has_calls(expected_calls) logging.getLogger().info(returned_item) assert returned_item['id'] == test_id