fixes fact jsonbfield for unit tests

This commit is contained in:
Chris Meyers
2016-11-21 17:25:18 -05:00
parent eeeea8ad88
commit ddd41e77be
6 changed files with 52 additions and 57 deletions

View File

@@ -26,7 +26,7 @@ def mock_feature_disabled(feature):
@pytest.mark.django_db
def test_cleanup_granularity(fact_scans, hosts):
def test_cleanup_granularity(fact_scans, hosts, monkeypatch_jsonbfield_get_db_prep_save):
epoch = timezone.now()
hosts(5)
fact_scans(10, timestamp_epoch=epoch)
@@ -40,7 +40,7 @@ def test_cleanup_granularity(fact_scans, hosts):
@pytest.mark.django_db
def test_cleanup_older_than(fact_scans, hosts):
def test_cleanup_older_than(fact_scans, hosts, monkeypatch_jsonbfield_get_db_prep_save):
'''
Delete half of the scans
'''
@@ -57,7 +57,7 @@ def test_cleanup_older_than(fact_scans, hosts):
@pytest.mark.django_db
def test_cleanup_older_than_granularity_module(fact_scans, hosts):
def test_cleanup_older_than_granularity_module(fact_scans, hosts, monkeypatch_jsonbfield_get_db_prep_save):
epoch = timezone.now()
hosts(5)
fact_scans(10, timestamp_epoch=epoch)
@@ -71,7 +71,7 @@ def test_cleanup_older_than_granularity_module(fact_scans, hosts):
@pytest.mark.django_db
def test_cleanup_logic(fact_scans, hosts):
def test_cleanup_logic(fact_scans, hosts, monkeypatch_jsonbfield_get_db_prep_save):
'''
Reduce the granularity of half of the facts scans, by half.
'''

View File

@@ -39,7 +39,7 @@ def check_process_fact_message_module(fact_returned, data, module_name):
@pytest.mark.django_db
def test_process_fact_message_ansible(fact_msg_ansible):
def test_process_fact_message_ansible(fact_msg_ansible, monkeypatch_jsonbfield_get_db_prep_save):
receiver = FactCacheReceiver()
fact_returned = receiver.process_fact_message(fact_msg_ansible)
@@ -47,7 +47,7 @@ def test_process_fact_message_ansible(fact_msg_ansible):
@pytest.mark.django_db
def test_process_fact_message_packages(fact_msg_packages):
def test_process_fact_message_packages(fact_msg_packages, monkeypatch_jsonbfield_get_db_prep_save):
receiver = FactCacheReceiver()
fact_returned = receiver.process_fact_message(fact_msg_packages)
@@ -55,7 +55,7 @@ def test_process_fact_message_packages(fact_msg_packages):
@pytest.mark.django_db
def test_process_fact_message_services(fact_msg_services):
def test_process_fact_message_services(fact_msg_services, monkeypatch_jsonbfield_get_db_prep_save):
receiver = FactCacheReceiver()
fact_returned = receiver.process_fact_message(fact_msg_services)
@@ -63,7 +63,7 @@ def test_process_fact_message_services(fact_msg_services):
@pytest.mark.django_db
def test_process_facts_message_ansible_overwrite(fact_scans, fact_msg_ansible):
def test_process_facts_message_ansible_overwrite(fact_scans, fact_msg_ansible, monkeypatch_jsonbfield_get_db_prep_save):
'''
We pickypack our fact sending onto the Ansible fact interface.
The interface is <hostname, facts>. Where facts is a json blob of all the facts.