Fixes an issue with the source tests failing. (#456)
This commit is contained in:
parent
f921b67fff
commit
fb178866f4
|
@ -163,6 +163,14 @@ def destination_plugin():
|
|||
return TestDestinationPlugin
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def source_plugin():
|
||||
from lemur.plugins.base import register
|
||||
from .plugins.source_plugin import TestSourcePlugin
|
||||
register(TestSourcePlugin)
|
||||
return TestSourcePlugin
|
||||
|
||||
|
||||
@pytest.yield_fixture(scope="function")
|
||||
def logged_in_user(session, app):
|
||||
with app.test_request_context():
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
from lemur.plugins.bases import SourcePlugin
|
||||
|
||||
|
||||
class TestSourcePlugin(SourcePlugin):
|
||||
title = 'Test'
|
||||
slug = 'test-source'
|
||||
description = 'Enables testing'
|
||||
|
||||
author = 'Kevin Glisson'
|
||||
author_url = 'https://github.com/netflix/lemur.git'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TestSourcePlugin, self).__init__(*args, **kwargs)
|
||||
|
||||
def get_certificates(self):
|
||||
return
|
|
@ -39,8 +39,8 @@ def test_create_certificate(source):
|
|||
(VALID_ADMIN_HEADER_TOKEN, 404),
|
||||
('', 401)
|
||||
])
|
||||
def test_source_get(client, token, status):
|
||||
assert client.get(api.url_for(Sources, source_id=1), headers=token).status_code == status
|
||||
def test_source_get(client, source_plugin, token, status):
|
||||
assert client.get(api.url_for(Sources, source_id=43543), headers=token).status_code == status
|
||||
|
||||
|
||||
@pytest.mark.parametrize("token,status", [
|
||||
|
@ -84,7 +84,7 @@ def test_source_patch(client, token, status):
|
|||
(VALID_ADMIN_HEADER_TOKEN, 200),
|
||||
('', 401)
|
||||
])
|
||||
def test_sources_list_get(client, token, status):
|
||||
def test_sources_list_get(client, source_plugin, token, status):
|
||||
assert client.get(api.url_for(SourcesList), headers=token).status_code == status
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue