(self)
| 110 | server=['server_direct.py'], sleep=0.5) |
| 111 | |
| 112 | def test_db_send_recv(self): |
| 113 | self.maxDiff = None |
| 114 | # setup databases |
| 115 | check_call(['db_ctrl.py', 'init', './src_db']) |
| 116 | check_call(['db_ctrl.py', 'init', './dst_db']) |
| 117 | with Popen(['db_ctrl.py', 'insert', './src_db'], stdin=subprocess.PIPE) as fill: |
| 118 | for i in range(100): |
| 119 | fill.stdin.write("Message-%i\n" % (i + 1)) |
| 120 | fill.stdin.close() |
| 121 | |
| 122 | # run send and recv |
| 123 | with Popen(['db_recv.py', '-m', '100']) as r: |
| 124 | with run(['db_send.py', '-m', '100']): |
| 125 | pass |
| 126 | r.wait() |
| 127 | # verify output of receive |
| 128 | actual = [line.strip() for line in r.stdout] |
| 129 | expected = ["inserted message %i" % (i + 1) for i in range(100)] |
| 130 | self.assertEqual(actual, expected) |
| 131 | |
| 132 | # verify state of databases |
| 133 | with run(['db_ctrl.py', 'list', './dst_db']) as v: |
| 134 | expected = ["(%i, 'Message-%i')" % (i + 1, i + 1) for i in range(100)] |
| 135 | actual = [line.strip() for line in v.stdout] |
| 136 | self.assertEqual(actual, expected) |
| 137 | |
| 138 | def test_tx_send_tx_recv(self): |
| 139 | self.test_simple_send_recv(recv='tx_recv.py', send='tx_send.py') |
nothing calls this directly
no test coverage detected