-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[py3.6] TypeError: write() argument must be str, not bytes #5888
Comments
@rplevka The returned certificate from nailgun is byte in py3, so perhaps we have to update the nailgun download_debug_certificate to always return str |
@ldjebran yeah, thanks for looking into this. yeah, this was just a placeholder issue, so i guess let's open up a nailgun one and keep it referenced |
Created PR SatelliteQE/nailgun#485 with this change. I was unable to run the test because mine Sat is hand-installed so |
@jhutar no the problem was about the saved saved value that was not correctly returned as we should use decode('utf-8') Think it seems to be more complicated to resolve that on nailgun perhaps fix the test to decode that returned value will be the simplest way to resolve this issue. ...
with self.assertRaises(SSLError):
client.get(repo_data_file_url, verify=False)
# get the organization debug certificate
cert_content = self.org.download_debug_certificate().decode('utf-8')
# save the organization debug certificate to file
cert_file_path = '{0}/{1}.pem'.format(
tempfile.gettempdir(), self.org.label)
with open(cert_file_path, 'w') as cert_file:
cert_file.write(cert_content)
# access repository data with organization debug certificate
response = client.get(
repo_data_file_url, cert=cert_file_path, verify=False)
... This should work in python 2 and python 3 |
+1 couple of similar issues were solved by adding |
Cool. It works with the fix you both proposed in the Nailgun PR:
|
SatelliteQE/nailgun#485 merged, so we are good here. |
TypeError: write() argument must be str, not bytes
tests.foreman.api.test_repository/RepositoryTestCase/test_positive_access_protected_repository
The text was updated successfully, but these errors were encountered: