allura
Revisão | f2fb1b1b4b8ac720212ad144626f8b6d469d7ab6 (tree) |
---|---|
Hora | 2010-05-27 04:24:56 |
Autor | Rick Copeland <rcopeland@geek...> |
Commiter | Rick Copeland |
[#461] - Add and fix tests
@@ -76,7 +76,12 @@ class RootController(BaseController): | ||
76 | 76 | def index(self): |
77 | 77 | """Handle the front-page.""" |
78 | 78 | c.project_summary = W.project_summary |
79 | - psort = [(n, M.Project.query.find(dict(is_root=True, neighborhood_id=n._id, deleted=False)).sort('shortname').all()) | |
79 | + psort = [ | |
80 | + (n, M.Project.query.find( | |
81 | + dict(is_root=True, | |
82 | + shortname={'$ne':'__init__'}, | |
83 | + neighborhood_id=n._id, | |
84 | + deleted=False)).sort('shortname').all()) | |
80 | 85 | for n in M.Neighborhood.query.find().sort('name')] |
81 | 86 | categories = M.ProjectCategory.query.find({'parent_id':None}).sort('name').all() |
82 | 87 | c.custom_sidebar_menu = [SitemapEntry('Categories')] + [ |
@@ -221,8 +221,9 @@ class ProjectRegistrationProvider(object): | ||
221 | 221 | pr = user.project_role() |
222 | 222 | pr.roles = [ role_owner._id, role_developer._id, role_member._id ] |
223 | 223 | # Setup builtin tool applications |
224 | - p.install_app('wiki', 'home') | |
225 | - p.install_app('admin', 'admin') | |
224 | + with h.push_config(c, user=users[0]): | |
225 | + p.install_app('wiki', 'home') | |
226 | + p.install_app('admin', 'admin') | |
226 | 227 | ThreadLocalORMSession.flush_all() |
227 | 228 | except: |
228 | 229 | ThreadLocalORMSession.close_all() |
@@ -9,6 +9,23 @@ from pyforge.tests import TestController | ||
9 | 9 | |
10 | 10 | class TestNeighborhood(TestController): |
11 | 11 | |
12 | + def test_home_project(self): | |
13 | + r = self.app.get('/adobe/home/') | |
14 | + assert r.location.endswith('/adobe/home/HomeHome/') | |
15 | + r = r.follow() | |
16 | + assert 'Welcome' in str(r), str(r) | |
17 | + r = self.app.get('/adobe/admin/') | |
18 | + assert r.location.endswith('/adobe/admin/overview') | |
19 | + r = r.follow() | |
20 | + assert 'admin' in str(r), str(r) | |
21 | + | |
22 | + def test_redirect(self): | |
23 | + r = self.app.post('/adobe/_admin/update', | |
24 | + params=dict(redirect='home/HomeHome/'), | |
25 | + extra_environ=dict(username='root')) | |
26 | + r = self.app.get('/adobe/') | |
27 | + assert r.location.endswith('/adobe/home/HomeHome/') | |
28 | + | |
12 | 29 | def test_admin(self): |
13 | 30 | r = self.app.get('/adobe/_admin/', extra_environ=dict(username='root')) |
14 | 31 | r = self.app.post('/adobe/_admin/update_acl', |
@@ -21,7 +21,7 @@ class TestRootController(TestController): | ||
21 | 21 | response = self.app.get('/') |
22 | 22 | assert response.html.find('h1').string == 'All Projects' |
23 | 23 | projects = response.html.findAll('ul',{'class':'display'})[0].findAll('li') |
24 | - assert len(projects) == 10 | |
24 | + assert len(projects) == 10, len(projects) | |
25 | 25 | assert projects[0].find('a').get('href') == '/adobe/' |
26 | 26 | assert projects[1].find('img').get('alt') == 'adobe_1 Icon' |
27 | 27 | cat_links = response.html.find('ul',{'id':'sidebarmenu'}).findAll('li') |
@@ -168,5 +168,6 @@ def _clear_subscriptions(): | ||
168 | 168 | for s in subs.subscriptions: |
169 | 169 | M.Mailbox.query.remove(dict(_id=s.mailbox_id)) |
170 | 170 | subs.subscriptions = [] |
171 | + M.Mailbox.query.remove({}) | |
171 | 172 | |
172 | 173 |
@@ -91,9 +91,9 @@ def bootstrap(command, conf, vars): | ||
91 | 91 | acl=dict(read=[None], create=[], |
92 | 92 | moderate=[root._id], admin=[root._id])) |
93 | 93 | project_reg = plugin.ProjectRegistrationProvider.get() |
94 | - p_projects = project_reg.register_neighborhood_project(n_projects, root) | |
95 | - p_users = project_reg.register_neighborhood_project(n_users, root) | |
96 | - p_adobe = project_reg.register_neighborhood_project(n_adobe, root) | |
94 | + p_projects = project_reg.register_neighborhood_project(n_projects, [root]) | |
95 | + p_users = project_reg.register_neighborhood_project(n_users, [root]) | |
96 | + p_adobe = project_reg.register_neighborhood_project(n_adobe, [root]) | |
97 | 97 | M.Theme(name='forge_default', |
98 | 98 | label='Default Forge Theme', |
99 | 99 | color1='#0088cc', |