Example #1
0
 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'
Example #2
0
 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
Example #3
0
 async def _test_list(self):
     title = random_string()
     await self.sm.create(title)
     return await self.sm.list()
Example #4
0
 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
Example #5
0
 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
Example #6
0
 async def _test_create(self):
     title = random_string()
     ok, res = await self.sm.create(title)
     assert ok is True
     assert res == title
Example #7
0
 async def _test_count(self):
     await self.cm.create(1, random_string())
     return await self.cm.count()