def test_00REGISTER(self): self.send(call('REGISTER',t0,t0)) self.assertTrue(self.receive().startswith(PACKAGE_START)) self.send(call('REGISTER',t1,t1)) self.assertTrue(self.receive().startswith(PACKAGE_START)) self.send(call('REGISTER',t2,t2)) self.assertTrue(self.receive().startswith(PACKAGE_START))
def test_11LOOKUP(self): if self.loginAs(t0): self.send(call('LOOKUP',t0)) self.assertEqual(self.receive(), easyResponse('LOOKUP',True)) self.send(call('LOOKUP',t1)) self.assertEqual(self.receive(), easyResponse('LOOKUP',True)) self.send(call('LOOKUP',t2)) self.assertEqual(self.receive(), easyResponse('LOOKUP',True))
def test_10TEST(self): if self.loginAs(t0): self.send(call('TEST')) self.assertEqual(self.receive(), easyResponse('TEST',True))
def test_01AUTH_FALSE(self): self.send(call('AUTH','\x03\x03\x03\x03\x03','000000')) self.assertEqual(self.receive(),easyResponse('LOGIN',False))
def test_01AUTH(self): self.send(call('AUTH',t0,t0)) self.assertEqual(self.receive(),easyResponse('LOGIN',True))
def loginAs(self,tu,passwd=None): if passwd==None: passwd=tu self.send(call('AUTH',tu,passwd)) return self.receive()==easyResponse('LOGIN',True)
def test_90REMOVE2(self): if self.loginAs(t2): self.send(call('REMOVE')) self.assertEqual(self.receive(), easyResponse('REMOVE',True))
def test_89PASSWD_LOGIN(self): if self.loginAs(t0,t0+'_'): self.send(call('PASSWD',t0+'_',t0)) self.assertEqual(self.receive(), easyResponse('PASSWD',True)) else: self.assertTrue(False)
def test_89PASSWD(self): if self.loginAs(t0): self.send(call('PASSWD',t0,t0+'_')) self.assertEqual(self.receive(), easyResponse('PASSWD',True))