def test_ensure_schema(self): """BasicLock.ensure_schema creates the table/columnfamily.""" expected = [ 'CREATE TABLE lock ("lockId" ascii, "claimId" timeuuid, PRIMARY KEY("lockId", "claimId"));', {}, 2] d = BasicLock.ensure_schema(self.client, 'lock') self.successResultOf(d) self.client.execute.assert_called_once_with(*expected)
def test_ensure_schema(self): """BasicLock.ensure_schema creates the table/columnfamily.""" expected = [ 'CREATE TABLE lock ("lockId" ascii, "claimId" timeuuid, PRIMARY KEY("lockId", "claimId"));', {}, 2 ] d = BasicLock.ensure_schema(self.client, 'lock') self.successResultOf(d) self.client.execute.assert_called_once_with(*expected)
def test_ensure_schema_already_created(self): """ BasicLock.ensure_schema doesn't explode on InvalidRequestException, meaning the table already exists. """ def _side_effect(*args, **kwargs): return defer.fail(InvalidRequestException()) self.client.execute.side_effect = _side_effect d = BasicLock.ensure_schema(self.client, 'lock') self.successResultOf(d)