Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 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)
Ejemplo n.º 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"})
Ejemplo n.º 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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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"
         }
     })
Ejemplo n.º 8
0
 def testRegisterFailedDatabase(self):
     register(1, "sid-1")
     register(1, "sid-1")
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 1)
Ejemplo n.º 9
0
 def testQueryEmptySid(self):
     resp = query("sid-1")
     self.assertEqual(len(resp["data"]), 0)
Ejemplo n.º 10
0
 def testQueryNotExistSid(self):
     resp = query("sid-13030708")
     self.assertEqual(len(resp["data"]), 0)