-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusage_example.py
58 lines (37 loc) · 1.47 KB
/
usage_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import pylons
from nous.pylons.testing.browser import NousTestApp, NousTestBrowser
from nous.pylons.testing import LayerBase, GrokLayer, CompositeLayer, PylonsTestBrowserLayer
from my.model import meta
here_dir = os.path.dirname(os.path.abspath(__file__))
conf_dir = os.path.dirname(os.path.dirname(os.path.dirname(here_dir)))
class YourBaseLayer(LayerBase):
def tearDown(self):
pass
def testSetUp(self):
pass
def testTearDown(self):
pass
YourLayer = CompositeLayer(GrokLayer,
PylonsTestBrowserLayer('test.ini', conf_dir, meta),
YourBaseLayer(),
name='YourLayer')
YourErrorsLayer = CompositeLayer(GrokLayer,
PylonsTestBrowserLayer('errors.ini', conf_dir, meta),
YourBaseLayer(),
name='YourErrorsLayer')
class YourTestBrowser(NousTestBrowser):
@classmethod
def logIn(cls, email='[email protected]', password='asdasd'):
browser = cls()
form = browser.getForm('loginForm')
form.getControl('Email').value = email
form.getControl('Password').value = password
form.getControl('Login').click()
return browser
def setUp(test):
test.globs['app'] = NousTestApp(pylons.test.pylonsapp)
test.globs['Browser'] = YourTestBrowser
def tearDown(test):
del test.globs['app']
del test.globs['Browser']