diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-01-20 03:12:04 +0200 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-01-20 04:00:42 +0200 |
| commit | 379efc632b601589a6bcfbafc35ab15cb89655ca (patch) | |
| tree | 614828468e98ca9d4a587ea5ce140623db684fe1 /src/server-tests | |
| parent | 969cdbc7f4c7ffc88c949881d8ac795b7bf7300e (diff) | |
mv ws_emit__topo_diff into test_util.py
Diffstat (limited to 'src/server-tests')
| -rw-r--r-- | src/server-tests/test_rz_mesh.py | 7 | ||||
| -rw-r--r-- | src/server-tests/test_util.py | 19 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/server-tests/test_rz_mesh.py b/src/server-tests/test_rz_mesh.py index aa6c9778..2d521712 100644 --- a/src/server-tests/test_rz_mesh.py +++ b/src/server-tests/test_rz_mesh.py @@ -41,13 +41,6 @@ class TestMeshAPI(unittest.TestCase): def tearDownClass(cls): pass - def _emit_tx_topo_diff(self): - with TestMeshAPI.rz_socket() as (_, ns_sock): - n_set = [{'__label_set': ['xxx'], 'id': generate_random_id__uuid() }] - topo_diff = Topo_Diff(node_set_add=n_set) - data = json.dumps(topo_diff, cls=Topo_Diff.JSON_Encoder) - ns_sock.emit('diff_commit__topo', data) - def test_REST_post_triggers_ws_multicast__topo_diff(self): class NS_test(BaseNamespace): diff --git a/src/server-tests/test_util.py b/src/server-tests/test_util.py index 594d0cbd..ba51c0f3 100644 --- a/src/server-tests/test_util.py +++ b/src/server-tests/test_util.py @@ -1,13 +1,18 @@ """ Various test utilities """ +import json + import db_controller as dbc +from model.graph import Topo_Diff from model.model import Link -from neo4j_test_util import gen_random_name +from neo4j_test_util import gen_random_name, rand_label from neo4j_util import generate_random_id__uuid +import neo4j_util from rz_kernel import RZ_Kernel from rz_mesh import init_ws_interface from rz_server import init_webapp +import test_rz_mesh def init_test_db_controller(cfg): @@ -51,3 +56,15 @@ def generate_random_link_dict(l_type, src_id, dst_id, lid=None): ret_dict['__type'] = [l_type] ret_dict['id'] = lid return ret_dict, lid + +def ws_emit__topo_diff(): + import logging + + r_label = rand_label() + n, n_id = generate_random_node_dict(r_label) + topo_diff = Topo_Diff(node_set_add=[n]) + data = json.dumps(topo_diff, cls=Topo_Diff.JSON_Encoder) + + with test_rz_mesh.RZ_websocket() as (_, ns_sock): + ns_sock.emit('diff_commit__topo', data) + |
