Пример #1
0
 def testUnregisterSuccessfulDatabase(self):
     register(1, "sid-1")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 1)
     unregister("sid-1", "name-1")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 0)
Пример #2
0
 def testRegisterIn2SidWithSameName(self):
     register(1, "sid-1")
     register(1, "sid-2")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 1)
     resp = query("sid-2")
     self.assertEqual(len(resp["data"]), 1)
Пример #3
0
 def testResetNotEmptySid(self):
     register(1, "sid-1")
     register(2, "sid-1")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 2)
     resetSid("sid-1")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 0)
Пример #4
0
 def testRegisterAndQuery(self):
     register(1, "sid-1")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 1)
     exitServer()
     time.sleep(0.5)
     resp = query("sid-1")
     self.assertEqual(resp["data"], {"name-1": "value-1"})
Пример #5
0
 def testRegisterPersistence(self):
     register(1, "sid-1")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 1)
     exitServer()
     time.sleep(0.5)
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 1)
Пример #6
0
 def testNotEmptySidResponse(self):
     register(1, "sid-1")
     register(2, "sid-1")
     resp = query("sid-1")
     self.assertEqual(resp, {
         "success": "true",
         "data": {
             "name-1": "value-1",
             "name-2": "value-2"
         }
     })
Пример #7
0
 def testUnregisterPersistence(self):
     register(1, "sid-1")
     register(2, "sid-1")
     register(3, "sid-1")
     unregister("sid-1", "name-2")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 2)
     exitServer()
     time.sleep(0.5)
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 2)
Пример #8
0
 def testResetExistSidResponse(self):
     register(1, "sid-1")
     resp = resetSid("sid-1")
     self.assertEqual(resp["success"], "true")
Пример #9
0
 def testRegisterFailedDatabase(self):
     register(1, "sid-1")
     register(1, "sid-1")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 1)
Пример #10
0
 def testRegisterFailedResponse(self):
     resp = register(1, "sid-1")
     self.assertEqual(resp["success"], "true")
     resp = register(1, "sid-1")
     self.assertEqual(resp["success"], "false")
Пример #11
0
 def testRegisterSuccessResponse(self):
     resp = register(1, "sid-1")
     self.assertEqual(resp["success"], "true")
Пример #12
0
 def testUnregisterSuccessfulResponse(self):
     register(1, "sid-1")
     resp = unregister("sid-1", "name-1")
     self.assertEqual(resp["success"], "true")