Resolves: upstream#3666 - Fix usage of str.decode() in our test

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit 99da72db23)
This commit is contained in:
Fabiano Fidêncio 2018-03-30 14:45:42 +02:00
parent 7d773ed035
commit 4d8a2ac870
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,48 @@
From 414ce6438a5450e5f1c1b03994f59d37f0ff8a36 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Fri, 16 Mar 2018 13:43:17 +0100
Subject: [PATCH 13/15] intg: convert results returned as bytes to strings
With python3 comparisons between byte literals and strings will fail. To
make sure assertions will pass the search results must be converted to
(utf-8) strings first.
Resolves https://pagure.io/SSSD/sssd/issue/3666
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
---
src/tests/intg/test_ts_cache.py | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/tests/intg/test_ts_cache.py b/src/tests/intg/test_ts_cache.py
index 703e3b255..c3819e21a 100644
--- a/src/tests/intg/test_ts_cache.py
+++ b/src/tests/intg/test_ts_cache.py
@@ -212,12 +212,17 @@ def get_attrs(ldb_conn, type, name, domain, attr_list):
ts_attrs = dict()
for attr in attr_list:
- sysdb_attrs[attr] = ldb_conn.get_entry_attr(
- sssd_ldb.CacheType.sysdb,
- type, name, domain, attr)
- ts_attrs[attr] = ldb_conn.get_entry_attr(
- sssd_ldb.CacheType.timestamps,
- type, name, domain, attr)
+ val = ldb_conn.get_entry_attr(sssd_ldb.CacheType.sysdb,
+ type, name, domain, attr)
+ if val:
+ val = val.decode('utf-8')
+ sysdb_attrs[attr] = val
+
+ val = ldb_conn.get_entry_attr(sssd_ldb.CacheType.timestamps,
+ type, name, domain, attr)
+ if val:
+ val = val.decode('utf-8')
+ ts_attrs[attr] = val
return (sysdb_attrs, ts_attrs)
--
2.14.3

View File

@ -54,6 +54,7 @@ Patch0009: 0009-KCM-Remove-mem_ctx-from-kcm_new_req.patch
Patch0010: 0010-KCM-Introduce-kcm_input_get_payload_len.patch
Patch0011: 0011-KCM-Do-not-use-2048-as-fixed-size-for-the-payload.patch
Patch0012: 0012-KCM-Adjust-REPLY_MAX-to-the-one-used-in-krb5.patch
Patch0013: 0013-intg-convert-results-returned-as-bytes-to-strings.patch
Patch0502: 0502-SYSTEMD-Use-capabilities.patch
Patch0503: 0503-Disable-stopping-idle-socket-activated-responders.patch
@ -1261,6 +1262,7 @@ fi
- Resolves: upstream#3687 - KCM: Don't pass a non null terminated string to
json_loads()
- Resolves: upstream#3386 - KCM: Payload buffer is too small
- Resolves: upstream#3666 - Fix usage of str.decode() in our tests
* Fri Mar 9 2018 Fabiano Fidêncio <fidencio@fedoraproject.org> - 1.16.1-1
- New upstream release 1.16.1