def test_add(self): slogan = random_string() res = self.loop.run_until_complete(self.protocol.add(slogan)) assert res == slogan res = self.loop.run_until_complete(self.protocol.add(slogan)) assert res == 'error: slogan already exists'
def test_rent(self): slogan = random_string() self.loop.run_until_complete(self.protocol.add(slogan)) status = self.loop.run_until_complete(self.protocol.rent()) assert status is True
async def _test_list(self): title = random_string() await self.sm.create(title) return await self.sm.list()
async def _test_rent_when_available(self): title = random_string() await self.sm.create(title) status, _ = await self.sm.rent(rented_by=title) assert status is True
async def _test_create_unique_constraint(self): title = random_string() await self.sm.create(title) ok, _ = await self.sm.create(title) assert ok is False
async def _test_create(self): title = random_string() ok, res = await self.sm.create(title) assert ok is True assert res == title
async def _test_count(self): await self.cm.create(1, random_string()) return await self.cm.count()