Merge pull request #1175 from cclauss/unicode-to-six-u

Change unicode() --> six.text_type() for Python 3
This commit is contained in:
Chris Church
2018-02-13 15:11:11 -05:00
committed by GitHub
16 changed files with 68 additions and 48 deletions

View File

@@ -2,6 +2,8 @@ import mock
import pytest
import json
import six
from awx.api.versioning import reverse
from awx.main.utils import timestamp_apiformat
from django.utils import timezone
@@ -105,7 +107,7 @@ def test_content(hosts, fact_scans, get, user, fact_ansible_json, monkeypatch_js
assert fact_known.host_id == response.data['host']
# TODO: Just make response.data['facts'] when we're only dealing with postgres, or if jsonfields ever fixes this bug
assert fact_ansible_json == (json.loads(response.data['facts']) if isinstance(response.data['facts'], unicode) else response.data['facts'])
assert fact_ansible_json == (json.loads(response.data['facts']) if isinstance(response.data['facts'], six.text_type) else response.data['facts'])
assert timestamp_apiformat(fact_known.timestamp) == response.data['timestamp']
assert fact_known.module == response.data['module']
@@ -117,7 +119,7 @@ def _test_search_by_module(hosts, fact_scans, get, user, fact_json, module_name)
(fact_known, response) = setup_common(hosts, fact_scans, get, user, module_name=module_name, get_params=params)
# TODO: Just make response.data['facts'] when we're only dealing with postgres, or if jsonfields ever fixes this bug
assert fact_json == (json.loads(response.data['facts']) if isinstance(response.data['facts'], unicode) else response.data['facts'])
assert fact_json == (json.loads(response.data['facts']) if isinstance(response.data['facts'], six.text_type) else response.data['facts'])
assert timestamp_apiformat(fact_known.timestamp) == response.data['timestamp']
assert module_name == response.data['module']