mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 11:41:08 -03:30
mock system tracking feature enabled
This commit is contained in:
@@ -15,6 +15,9 @@ from awx.main.management.commands.cleanup_facts import CleanupFacts, Command
|
|||||||
from awx.main.models.fact import Fact
|
from awx.main.models.fact import Fact
|
||||||
from awx.main.models.inventory import Host
|
from awx.main.models.inventory import Host
|
||||||
|
|
||||||
|
def mock_feature_enabled(feature, bypass_database=None):
|
||||||
|
return True
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_cleanup_granularity(fact_scans, hosts):
|
def test_cleanup_granularity(fact_scans, hosts):
|
||||||
epoch = timezone.now()
|
epoch = timezone.now()
|
||||||
@@ -88,6 +91,7 @@ def test_cleanup_logic(fact_scans, hosts):
|
|||||||
timestamp_pivot -= granularity
|
timestamp_pivot -= granularity
|
||||||
assert fact.timestamp == timestamp_pivot
|
assert fact.timestamp == timestamp_pivot
|
||||||
|
|
||||||
|
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_parameters_ok(mocker):
|
def test_parameters_ok(mocker):
|
||||||
run = mocker.patch('awx.main.management.commands.cleanup_facts.CleanupFacts.run')
|
run = mocker.patch('awx.main.management.commands.cleanup_facts.CleanupFacts.run')
|
||||||
@@ -158,6 +162,7 @@ def test_string_time_to_timestamp_invalid():
|
|||||||
res = cmd.string_time_to_timestamp(kv['time'])
|
res = cmd.string_time_to_timestamp(kv['time'])
|
||||||
assert res is None
|
assert res is None
|
||||||
|
|
||||||
|
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_parameters_fail(mocker):
|
def test_parameters_fail(mocker):
|
||||||
# Mock run() just in case, but it should never get called because an error should be thrown
|
# Mock run() just in case, but it should never get called because an error should be thrown
|
||||||
|
|||||||
Reference in New Issue
Block a user