示例#1
0
 def test_save_and_delete_one_value(self, adhsserver):
     c = AdhsClient()
     c.connectToServer('ipc://testserver.sock')
     c.save('/bla', 'BLUB')
     assert c.get('/bla') == 'BLUB'
     c.delete('/bla')
     assert c.has_key('/bla') == False
示例#2
0
 def test_save_one_value(self, adhsserver):
     c = AdhsClient()
     c.connectToServer('ipc://testserver.sock')
     c.save('/bla', 'BLUB BLOB')
     assert len(adhsserver.known_hashes()) == 1
示例#3
0
 def test_save_and_get_one_value(self, adhsserver):
     c = AdhsClient()
     c.connectToServer('ipc://testserver.sock')
     c.save('/bla', 'BLUB BLOB')
     assert c.get('/bla') == 'BLUB BLOB'
示例#4
0
 def test_search_existing_key(self, adhsserver):
     c = AdhsClient()
     c.connectToServer('ipc://testserver.sock')
     c.save('/bla', 'BLUB')
     assert c.has_key('/bla') == True
     assert c.has_key('/blub') == False
示例#5
0
 def test_search_non_existing_key(self, adhsserver):
     c = AdhsClient()
     c.connectToServer('ipc://testserver.sock')
     assert c.has_key('/bla') == False
示例#6
0
 def test_get_not_existing_value(self, adhsserver):
     c = AdhsClient()
     c.connectToServer('ipc://testserver.sock')
     with pytest.raises(KeyError):
         c.get('/bla')
示例#7
0
 def test_start_one_server(self, adhsserver):
     c = AdhsClient()
     c.connectToServer('ipc://testserver.sock')
     assert len(c.active_servers()) == 1
     assert len(adhsserver.known_hashes()) == 0
示例#8
0
 def test_reach_zero_servers(self):
     '''As no server is started, asking the number of servers should be 0'''
     c = AdhsClient()
     assert len(c.active_servers()) == 0