mirror of
https://github.com/ansible/awx.git
synced 2026-04-10 12:39:22 -02:30
Fixed fact cache test difference between sqlite3 and postgres
I guess the sqlite adaptation of the JSONField was resulting in a json encoded blob, where as the postgres version returned something that got parsed out normally with the rest of the query result?
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import mock
|
import mock
|
||||||
import pytest
|
import pytest
|
||||||
import json
|
|
||||||
|
|
||||||
from awx.main.utils import timestamp_apiformat
|
from awx.main.utils import timestamp_apiformat
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
@@ -94,7 +93,7 @@ def test_content(hosts, fact_scans, get, user, fact_ansible_json):
|
|||||||
(fact_known, response) = setup_common(hosts, fact_scans, get, user)
|
(fact_known, response) = setup_common(hosts, fact_scans, get, user)
|
||||||
|
|
||||||
assert fact_known.host_id == response.data['host']
|
assert fact_known.host_id == response.data['host']
|
||||||
assert fact_ansible_json == json.loads(response.data['facts'])
|
assert fact_ansible_json == response.data['facts']
|
||||||
assert timestamp_apiformat(fact_known.timestamp) == response.data['timestamp']
|
assert timestamp_apiformat(fact_known.timestamp) == response.data['timestamp']
|
||||||
assert fact_known.module == response.data['module']
|
assert fact_known.module == response.data['module']
|
||||||
|
|
||||||
@@ -104,7 +103,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)
|
(fact_known, response) = setup_common(hosts, fact_scans, get, user, module_name=module_name, get_params=params)
|
||||||
|
|
||||||
assert fact_json == json.loads(response.data['facts'])
|
assert fact_json == response.data['facts']
|
||||||
assert timestamp_apiformat(fact_known.timestamp) == response.data['timestamp']
|
assert timestamp_apiformat(fact_known.timestamp) == response.data['timestamp']
|
||||||
assert module_name == response.data['module']
|
assert module_name == response.data['module']
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
# Python
|
# Python
|
||||||
import pytest
|
import pytest
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
@@ -80,8 +79,8 @@ def test_process_facts_message_ansible_overwrite(fact_scans, fact_msg_ansible):
|
|||||||
|
|
||||||
fact_obj = Fact.objects.get(id=fact_returned.id)
|
fact_obj = Fact.objects.get(id=fact_returned.id)
|
||||||
assert key in fact_obj.facts
|
assert key in fact_obj.facts
|
||||||
assert json.loads(fact_obj.facts) == fact_msg_ansible['facts']
|
assert fact_obj.facts == fact_msg_ansible['facts']
|
||||||
assert value == json.loads(fact_obj.facts)[key]
|
assert value == fact_obj.facts[key]
|
||||||
|
|
||||||
# Ensure that the message flows from the socket through to process_fact_message()
|
# Ensure that the message flows from the socket through to process_fact_message()
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
|||||||
Reference in New Issue
Block a user