Files
multi-user/test_replication.py

56 lines
1.2 KiB
Python
Raw Normal View History

2019-07-04 15:56:03 +02:00
import unittest
2019-07-05 18:07:16 +02:00
from replication import ReplicatedDatablock, ReplicatedDataFactory
import umsgpack
import logging
from replication_client import Client
log = logging.getLogger(__name__)
class SampleData():
def __init__(self):
self.map = {
"sample":"data",
"sample":"data",
"sample":"data",
"sample":"data"
}
class RepSampleData(ReplicatedDatablock):
def serialize(self,data):
import pickle
return pickle.dumps(data)
def deserialize(self,data):
import pickle
return pickle.load(data)
2019-07-04 15:56:03 +02:00
class TestData(unittest.TestCase):
def setUp(self):
self.map = {}
2019-07-05 18:07:16 +02:00
self.client_api = Client()
def test_setup_data_factory(self):
factory = ReplicatedDataFactory()
factory.register_type(SampleData, RepSampleData)
def test_run_client(self):
self.client_api.connect()
def test_stop_client(self):
self.client_api.stop()
def test_add_replicated_value(self):
pass
2019-07-04 15:56:03 +02:00
def test_create_replicated_data(self):
self.assertNotEqual(self.sample_data.uuid,None)
2019-07-05 18:07:16 +02:00
2019-07-04 15:56:03 +02:00
if __name__ == '__main__':
unittest.main()