mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 13:27:40 -02:30
do not coerce jsonbfield to string in db
* functional tests do coerce because they assume they are running on sqlite
This commit is contained in:
@@ -7,7 +7,7 @@ from awx.main.models import Fact
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_newest_scan_exact(hosts, fact_scans):
|
def test_newest_scan_exact(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
hosts = hosts(host_count=2)
|
hosts = hosts(host_count=2)
|
||||||
facts = fact_scans(fact_scans=3, timestamp_epoch=epoch)
|
facts = fact_scans(fact_scans=3, timestamp_epoch=epoch)
|
||||||
@@ -23,7 +23,7 @@ def test_newest_scan_exact(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_newest_scan_less_than(hosts, fact_scans):
|
def test_newest_scan_less_than(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
'''
|
'''
|
||||||
Show me the most recent state of the sytem at any point of time.
|
Show me the most recent state of the sytem at any point of time.
|
||||||
or, said differently
|
or, said differently
|
||||||
@@ -52,7 +52,7 @@ def test_newest_scan_less_than(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_query_middle_of_timeline(hosts, fact_scans):
|
def test_query_middle_of_timeline(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
'''
|
'''
|
||||||
Tests query Fact that is in the middle of the fact scan timeline, but not an exact timestamp.
|
Tests query Fact that is in the middle of the fact scan timeline, but not an exact timestamp.
|
||||||
'''
|
'''
|
||||||
@@ -74,7 +74,7 @@ def test_query_middle_of_timeline(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_query_result_empty(hosts, fact_scans):
|
def test_query_result_empty(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
'''
|
'''
|
||||||
Query time less than any fact scan. Should return None
|
Query time less than any fact scan. Should return None
|
||||||
'''
|
'''
|
||||||
@@ -89,7 +89,7 @@ def test_query_result_empty(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_by_module(hosts, fact_scans):
|
def test_by_module(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
'''
|
'''
|
||||||
Query by fact module other than 'ansible'
|
Query by fact module other than 'ansible'
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ def setup_common(hosts, fact_scans, ts_from=None, ts_to=None, epoch=timezone.now
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_all(hosts, fact_scans):
|
def test_all(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
ts_from = epoch - timedelta(days=1)
|
ts_from = epoch - timedelta(days=1)
|
||||||
ts_to = epoch + timedelta(days=10)
|
ts_to = epoch + timedelta(days=10)
|
||||||
@@ -34,7 +34,7 @@ def test_all(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_all_ansible(hosts, fact_scans):
|
def test_all_ansible(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
ts_from = epoch - timedelta(days=1)
|
ts_from = epoch - timedelta(days=1)
|
||||||
ts_to = epoch + timedelta(days=10)
|
ts_to = epoch + timedelta(days=10)
|
||||||
@@ -48,7 +48,7 @@ def test_all_ansible(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_empty_db(hosts, fact_scans):
|
def test_empty_db(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
hosts = hosts(host_count=2)
|
hosts = hosts(host_count=2)
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
ts_from = epoch - timedelta(days=1)
|
ts_from = epoch - timedelta(days=1)
|
||||||
@@ -60,7 +60,7 @@ def test_empty_db(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_no_results(hosts, fact_scans):
|
def test_no_results(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
ts_from = epoch - timedelta(days=100)
|
ts_from = epoch - timedelta(days=100)
|
||||||
ts_to = epoch - timedelta(days=50)
|
ts_to = epoch - timedelta(days=50)
|
||||||
@@ -70,7 +70,7 @@ def test_no_results(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_exact_same_equal(hosts, fact_scans):
|
def test_exact_same_equal(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
ts_to = ts_from = epoch + timedelta(days=1)
|
ts_to = ts_from = epoch + timedelta(days=1)
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ def test_exact_same_equal(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_exact_from_exclusive_to_inclusive(hosts, fact_scans):
|
def test_exact_from_exclusive_to_inclusive(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
ts_from = epoch + timedelta(days=1)
|
ts_from = epoch + timedelta(days=1)
|
||||||
ts_to = epoch + timedelta(days=2)
|
ts_to = epoch + timedelta(days=2)
|
||||||
@@ -96,7 +96,7 @@ def test_exact_from_exclusive_to_inclusive(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_to_lte(hosts, fact_scans):
|
def test_to_lte(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
ts_to = epoch + timedelta(days=1)
|
ts_to = epoch + timedelta(days=1)
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ def test_to_lte(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_from_gt(hosts, fact_scans):
|
def test_from_gt(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
ts_from = epoch
|
ts_from = epoch
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ def test_from_gt(hosts, fact_scans):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_no_ts(hosts, fact_scans):
|
def test_no_ts(hosts, fact_scans, monkeypatch_jsonbfield_get_db_prep_save):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
|
|
||||||
(facts_known, fact_objs) = setup_common(hosts, fact_scans, ts_from=None, ts_to=None, epoch=epoch)
|
(facts_known, fact_objs) = setup_common(hosts, fact_scans, ts_from=None, ts_to=None, epoch=epoch)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ django-celery==3.1.17
|
|||||||
django-crum==0.6.1
|
django-crum==0.6.1
|
||||||
django-extensions==1.5.9
|
django-extensions==1.5.9
|
||||||
django-jsonfield==1.0.1
|
django-jsonfield==1.0.1
|
||||||
git+https://github.com/ansible/django-jsonbfield@fix-sqlite_serialization#egg=jsonbfield
|
git+https://github.com/ansible/django-jsonbfield@master#egg=jsonbfield
|
||||||
django-polymorphic==0.7.2
|
django-polymorphic==0.7.2
|
||||||
django-radius==1.0.0
|
django-radius==1.0.0
|
||||||
djangorestframework==3.3.2
|
djangorestframework==3.3.2
|
||||||
|
|||||||
Reference in New Issue
Block a user