feat: comments

This commit is contained in:
Swann Martinez 2019-07-22 18:18:11 +02:00
parent 273a659bfe
commit 9a7a42d03a
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
2 changed files with 29 additions and 3 deletions

View File

@ -25,13 +25,25 @@ class Client(object):
self._factory = factory
def connect(self,address="127.0.0.1",port=5560):
"""
Connect to the server
"""
self._net_client.connect(address=address,port=port)
def disconnect(self):
"""
Disconnect from server, reset the client
"""
self._net_client.stop()
@property
def state(self):
"""
Return the client state
0: STATE_INITIAL
1: STATE_SYNCING
2: STATE_ACTIVE
"""
return self._net_client.state
def register(self, object):
@ -49,7 +61,7 @@ class Client(object):
logger.info("Registering {} on {}".format(object,new_item.uuid))
new_item.store(self._rep_store)
logger.info("Pushing changes...")
logger.info("Pushing new registered value")
new_item.push(self._net_client.publish)
return new_item.uuid
@ -57,9 +69,17 @@ class Client(object):
raise TypeError("Type not supported")
def pull(self,object=None):
"""
Asynchonous pull
Here we want to pull all waiting changes and apply them
"""
pass
def unregister(self,object):
def unregister(self,object_uuid):
"""
Unregister for replication the given
object
"""
pass
class ClientNetService(threading.Thread):

View File

@ -159,13 +159,19 @@ class TestClient(unittest.TestCase):
self.assertEqual(test_map_result.map["toto"], test_map["toto"])
def suite():
suite = unittest.TestSuite()
# Data factory
suite.addTest(TestDataFactory('test_data_factory'))
# Client
suite.addTest(TestClient('test_empty_snapshot'))
suite.addTest(TestClient('test_filled_snapshot'))
suite.addTest(TestClient('test_register_client_data'))
suite.addTest(TestClient('test_client_data_intergity'))
return suite
if __name__ == '__main__':