def test_delete_multi_w_existing_transaction(self): creds = object() client = self._makeOne(credentials=creds) key = _Key(self.PROJECT) with _NoCommitTransaction(client) as CURR_XACT: result = client.delete_multi([key]) self.assertIsNone(result) mutated_key = _mutated_pb(self, CURR_XACT.mutations, 'delete') self.assertEqual(mutated_key, key._key) self.assertEqual(len(client.connection._commit_cw), 0)
def test_delete_multi_no_batch(self): key = _Key(self.PROJECT) creds = object() client = self._makeOne(credentials=creds) client.connection._commit.append([]) result = client.delete_multi([key]) self.assertEqual(result, None) self.assertEqual(len(client.connection._commit_cw), 1) (project, commit_req, transaction_id) = client.connection._commit_cw[0] self.assertEqual(project, self.PROJECT) mutated_key = _mutated_pb(self, commit_req.mutations, 'delete') self.assertEqual(mutated_key, key.to_protobuf()) self.assertTrue(transaction_id is None)
def test_delete_multi_no_batch(self): key = _Key(self.PROJECT) creds = object() client = self._makeOne(credentials=creds) client.connection._commit.append([]) result = client.delete_multi([key]) self.assertIsNone(result) self.assertEqual(len(client.connection._commit_cw), 1) (project, commit_req, transaction_id) = client.connection._commit_cw[0] self.assertEqual(project, self.PROJECT) mutated_key = _mutated_pb(self, commit_req.mutations, 'delete') self.assertEqual(mutated_key, key.to_protobuf()) self.assertIsNone(transaction_id)
def test_delete_multi_no_keys(self): creds = object() client = self._makeOne(credentials=creds) result = client.delete_multi([]) self.assertIsNone(result) self.assertEqual(len(client.connection._commit_cw), 0)