Commit 103f75ef authored by Xiaowu Zhang's avatar Xiaowu Zhang

test_registry_client: use flush

parent cf0d717b
...@@ -84,11 +84,10 @@ class TestRegistryClientInteract(unittest.TestCase): ...@@ -84,11 +84,10 @@ class TestRegistryClientInteract(unittest.TestCase):
# creat x509.cert object # creat x509.cert object
def write_to_temp(text): def write_to_temp(text):
"""text: bytes""" """text: bytes"""
fp = tempfile.NamedTemporaryFile() file = tempfile.NamedTemporaryFile()
fp.write(text) file.write(text)
# when reopen a fp, python seems reuse the fd, so seek is needed file.flush()
fp.seek(0) return file
return fp
ca, key, cert = map(write_to_temp, (ca, key, cert)) ca, key, cert = map(write_to_temp, (ca, key, cert))
client.cert = x509.Cert(ca.name, key.name, cert.name) client.cert = x509.Cert(ca.name, key.name, cert.name)
......
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