Commit cb4dc998 authored by zhifan huang's avatar zhifan huang

test: fix test failed in net namespace

mock socks.sendto related function
parent 183cc381
......@@ -235,6 +235,7 @@ class TestRegistryServer(unittest.TestCase):
# TODO test too many prefix
@patch("re6st.registry.RegistryServer.sendto", Mock())
@patch("re6st.registry.RegistryServer.createCertificate")
def test_requestCertificate(self, mock_func):
token = self.server.addToken(self.email, None)
......@@ -312,6 +313,7 @@ class TestRegistryServer(unittest.TestCase):
delete_cert(cur, prefix_new)
cur.close()
@patch("re6st.registry.RegistryServer.sendto", Mock())
@patch("re6st.registry.RegistryServer.recv")
@patch("select.select", Mock(return_value=[1]))
def test_queryAddress(self, recv):
......@@ -348,6 +350,7 @@ class TestRegistryServer(unittest.TestCase):
self.assertIsNone(self.server.sessions.get(prefix))
self.assertIsNone(get_cert(self.server.db, prefix))
@patch("re6st.registry.RegistryServer.sendto", Mock())
def test_updateHMAC(self):
def get_hmac():
return [self.server.getConfig(registry.BABEL_HMAC[i], None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment