freeipa/ipatests/test_ipaserver
Rob Crittenden 9a97f9b40c Fix test_secure_ajp_connector.py failing with Python 3.6.8
Some of the test data are not expected to cause a rewrite in
the upgrade code. Those that do will set the rewrite flag.

In that case there is a new server.xml to be read. This is
handled with mock_open(). The contents can be retrieved via
mocked_file().write.call_args but the repr() of it is:

call(b'<Server port="1234" shutdown="SHUTDOWN">\n  ...')

In at least Python 3.10 one can use write.call_args.args to get
just the raw data. This does not work with Python 3.6.8 and
returns the string 'args' instead results in a TypeError.

TypeError: a bytes-like object is required, not 'str'

Instead drop the args and use the data directly.

For the case of x = mocked_file().write.call_args:

   x[0] is a tuple with the first element being the data
   x[0][0] is the raw data

So use x[0][0] to get at the data instead of x.args[0]

Fixes: https://pagure.io/freeipa/issue/9190

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2022-06-23 17:46:57 -04:00
..
data ipa-otptoken-import: Make PBKDF2 refer to the pkcs5 namespace 2017-09-01 10:50:34 +02:00
test_install pylint: Fix useless-suppression 2022-03-11 13:37:08 -05:00
__init__.py pytest 3.x compatibility 2017-03-27 18:03:14 +02:00
httptest.py pylint: Fix useless-suppression 2022-03-11 13:37:08 -05:00
test_adtrust_mockup.py pytest: Migrate unittest/nose to Pytest fixtures 2020-02-12 18:08:32 +02:00
test_changepw.py pytest: Migrate unittest/nose to Pytest fixtures 2020-02-12 18:08:32 +02:00
test_dnssec.py ipapython: move dnssec, p11helper and secrets to ipaserver 2016-11-29 14:50:51 +01:00
test_i18n_messages.py Add tests for "i18n_messages" end point 2018-07-17 15:32:28 -04:00
test_ipap11helper.py Py3: Remove subclassing from object 2018-09-27 11:49:04 +02:00
test_jsplugins.py ipatests: Skip test_jsplugins in server less environments 2021-03-30 13:16:36 +03:00
test_kadmin.py ipa-kdb: test kadmin.local getprincs command 2020-09-10 11:57:14 -04:00
test_ldap.py Silence W601 .has_key() is deprecated 2020-05-05 10:42:46 +02:00
test_migratepw.py pytest: Migrate xunit-style setups to Pytest fixtures 2020-02-12 18:08:32 +02:00
test_otptoken_import.py Py3: Remove subclassing from object 2018-09-27 11:49:04 +02:00
test_rpcserver.py Py3: Remove subclassing from object 2018-09-27 11:49:04 +02:00
test_secrets.py pytest: Migrate unittest/nose to Pytest fixtures 2020-02-12 18:08:32 +02:00
test_secure_ajp_connector.py Fix test_secure_ajp_connector.py failing with Python 3.6.8 2022-06-23 17:46:57 -04:00
test_serverroles.py Use api.env.container_sysaccounts 2020-04-28 11:28:29 +02:00
test_topology_plugin.py ds: Support renaming of a replication plugin in 389-ds 2021-06-01 17:09:28 +03:00
test_version_comparison.py Py3: Remove subclassing from object 2018-09-27 11:49:04 +02:00