diff --git a/lemur/tests/conftest.py b/lemur/tests/conftest.py index 98ffb438..24637277 100644 --- a/lemur/tests/conftest.py +++ b/lemur/tests/conftest.py @@ -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(): diff --git a/lemur/tests/plugins/source_plugin.py b/lemur/tests/plugins/source_plugin.py new file mode 100644 index 00000000..c08e7390 --- /dev/null +++ b/lemur/tests/plugins/source_plugin.py @@ -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 diff --git a/lemur/tests/test_sources.py b/lemur/tests/test_sources.py index c3dd613c..7b428505 100644 --- a/lemur/tests/test_sources.py +++ b/lemur/tests/test_sources.py @@ -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