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):
# creat x509.cert object
def write_to_temp(text):
"""text: bytes"""
fp = tempfile.NamedTemporaryFile()
fp.write(text)
# when reopen a fp, python seems reuse the fd, so seek is needed
fp.seek(0)
return fp
file = tempfile.NamedTemporaryFile()
file.write(text)
file.flush()
return file
ca, key, cert = map(write_to_temp, (ca, key, cert))
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