def test_socket_setup(self, context_factory): publisher.Publisher('endpoint', 999) context = context_factory.return_value context.socket.assert_called_with(zmq.PUSH) s = context.socket.return_value s.bind.assert_called_with('endpoint') self.assertEqual(s.hwm, 999)
def test_message_format(self, socket): p = publisher.Publisher('endpoint', 999) msg = { 'key': 'value', 'key2': ['v1', 1], } p._send('message type name', msg) s = socket.return_value s.send_multipart.assert_called_with( ['message type name', json.dumps(msg)])
def take_action(self, parsed_args): # Fix import path cwd = os.getcwd() if cwd not in sys.path and os.curdir not in sys.path: sys.path.insert(0, cwd) # Fix command line args sys.argv = parsed_args.command # Run the app p = publisher.Publisher(parsed_args.socket) t = tracer.Tracer(p) t.run(parsed_args.command) return
def take_action(self, parsed_args): # Fix import path cwd = os.getcwd() if cwd not in sys.path and os.curdir not in sys.path: sys.path.insert(0, cwd) # Fix command line args sys.argv = parsed_args.command # Run the app if parsed_args.mode == 'remote': p = publisher.Publisher(parsed_args.socket) else: p = local.LocalPublisher(parsed_args.database) t = tracer.Tracer(p) t.run(parsed_args.command) return