|
|
|
import pytest
|
|
|
|
|
|
|
|
from pyramid.httpexceptions import HTTPFound
|
|
|
|
from pyramid.testing import DummyRequest
|
|
|
|
|
|
|
|
|
|
|
|
from .. import app_config, dbsession, get_example_user # noqa: F401
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'user,location',
|
|
|
|
[(None, '/account/login'), ('someone', '/orders')]
|
|
|
|
)
|
|
|
|
def test_welcome(user, location):
|
|
|
|
''' test redirects on web root '''
|
|
|
|
from ordr.views.pages import welcome
|
|
|
|
|
|
|
|
request = DummyRequest(user=user)
|
|
|
|
result = welcome(None, request)
|
|
|
|
|
|
|
|
assert isinstance(result, HTTPFound)
|
|
|
|
assert result.location == f'http://example.com/{location}'
|
|
|
|
|
|
|
|
|
|
|
|
def test_faq():
|
|
|
|
''' test the view for the faq page '''
|
|
|
|
from ordr.views.pages import faq
|
|
|
|
result = faq(None, None)
|
|
|
|
assert result == {}
|