Fixes an issue with the source tests failing. (#456)

This commit is contained in:
kevgliss 2016-10-16 03:55:37 -07:00 committed by GitHub
parent f921b67fff
commit fb178866f4
3 changed files with 27 additions and 3 deletions

View File

@ -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():

View File

@ -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

View File

@ -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