class TestOMFALH(unittest.TestCase): def setUp(self): self.socket_path = "/tmp/alh.sock" self.alh = MockALH() clusters = {'test': self.alh} self.a = ALHAuthProxy(self.socket_path, clusters=clusters) self.t = threading.Thread(target=self.a.start) self.t.start() while not os.path.exists(self.socket_path): pass def tearDown(self): if self.a is not None: self.a.stop() self.t.join() def test_get_request(self): alh = ALH(cluster_uid='test', socket_path=self.socket_path) r = alh.get('hello') self.assertEqual(r, 'get') def test_post_request(self): alh = ALH(cluster_uid='test', socket_path=self.socket_path) r = alh.post('hello', '1') self.assertEqual(r, 'post')
def setUp(self): self.socket_path = "/tmp/alh.sock" self.alh = MockALH() clusters = {'test': self.alh} self.a = ALHAuthProxy(self.socket_path, clusters=clusters) self.t = threading.Thread(target=self.a.start) self.t.start() while not os.path.exists(self.socket_path): pass