Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#29802925]
- Loading branch information
Reed O'Brien
committed
May 31, 2012
1 parent
f4c735f
commit 75c29b1
Showing
1 changed file
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,50 @@ | ||
from kotti.testing import FunctionalTestBase | ||
|
||
from kotti.testing import ( | ||
tearDown, | ||
testing_db_url, | ||
) | ||
|
||
BASE_URL = 'http://localhost:5000' | ||
|
||
|
||
def setUpFunctional(global_config=None, **settings): | ||
from kotti import main | ||
import wsgi_intercept.zope_testbrowser | ||
from webtest import TestApp | ||
|
||
tearDown() | ||
|
||
_settings = { | ||
'sqlalchemy.url': testing_db_url(), | ||
'kotti.secret': 'secret', | ||
'kotti.site_title': 'Test Splash Page', # for mailing | ||
'kotti.populators': | ||
'kotti.testing._populator\nkotti_splashpage.populate', | ||
'mail.default_sender': 'kotti@localhost', | ||
'kotti.includes': 'kotti_splashpage' | ||
} | ||
_settings.update(settings) | ||
|
||
host, port = BASE_URL.split(':')[-2:] | ||
app = main({}, **_settings) | ||
wsgi_intercept.add_wsgi_intercept(host[2:], int(port), lambda: app) | ||
Browser = wsgi_intercept.zope_testbrowser.WSGI_Browser | ||
|
||
return dict( | ||
Browser=Browser, | ||
browser=Browser(), | ||
test_app=TestApp(app), | ||
) | ||
|
||
|
||
class TestSplashFunctional(FunctionalTestBase): | ||
BASE_URL = BASE_URL | ||
|
||
def setUp(self, **kwargs): | ||
self.__dict__.update(setUpFunctional(**kwargs)) | ||
|
||
class TestLogin(FunctionalTestBase): | ||
def test_it(self): | ||
assert self.browser.status == '200 OK' | ||
assert 'SPLASH PAGE' in self | ||
result = self.test_app.get('/') | ||
assert result.status == '200 OK' | ||
assert 'SPLASH PAGE' in result.body |