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