mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
Skip activity stream tests if activity stream is disabled
This commit is contained in:
@@ -4,10 +4,12 @@ import pytest
|
|||||||
from awx.main.middleware import ActivityStreamMiddleware
|
from awx.main.middleware import ActivityStreamMiddleware
|
||||||
from awx.main.models.activity_stream import ActivityStream
|
from awx.main.models.activity_stream import ActivityStream
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
def mock_feature_enabled(feature, bypass_database=None):
|
def mock_feature_enabled(feature, bypass_database=None):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not getattr(settings, 'ACTIVITY_STREAM_ENABLED', True), reason="Activity stream not enabled")
|
||||||
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
|
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_get_activity_stream_list(monkeypatch, organization, get, user):
|
def test_get_activity_stream_list(monkeypatch, organization, get, user):
|
||||||
@@ -16,6 +18,7 @@ def test_get_activity_stream_list(monkeypatch, organization, get, user):
|
|||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not getattr(settings, 'ACTIVITY_STREAM_ENABLED', True), reason="Activity stream not enabled")
|
||||||
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
|
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_basic_fields(monkeypatch, organization, get, user):
|
def test_basic_fields(monkeypatch, organization, get, user):
|
||||||
@@ -35,6 +38,7 @@ def test_basic_fields(monkeypatch, organization, get, user):
|
|||||||
assert 'organization' in response.data['summary_fields']
|
assert 'organization' in response.data['summary_fields']
|
||||||
assert response.data['summary_fields']['organization'][0]['name'] == 'test-org'
|
assert response.data['summary_fields']['organization'][0]['name'] == 'test-org'
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not getattr(settings, 'ACTIVITY_STREAM_ENABLED', True), reason="Activity stream not enabled")
|
||||||
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
|
@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled)
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_middleware_actor_added(monkeypatch, post, get, user):
|
def test_middleware_actor_added(monkeypatch, post, get, user):
|
||||||
|
|||||||
Reference in New Issue
Block a user