• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revisãof2fb1b1b4b8ac720212ad144626f8b6d469d7ab6 (tree)
Hora2010-05-27 04:24:56
AutorRick Copeland <rcopeland@geek...>
CommiterRick Copeland

Mensagem de Log

[#461] - Add and fix tests

Mudança Sumário

Diff

--- a/pyforge/pyforge/controllers/root.py
+++ b/pyforge/pyforge/controllers/root.py
@@ -76,7 +76,12 @@ class RootController(BaseController):
7676 def index(self):
7777 """Handle the front-page."""
7878 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())
8085 for n in M.Neighborhood.query.find().sort('name')]
8186 categories = M.ProjectCategory.query.find({'parent_id':None}).sort('name').all()
8287 c.custom_sidebar_menu = [SitemapEntry('Categories')] + [
--- a/pyforge/pyforge/lib/plugin.py
+++ b/pyforge/pyforge/lib/plugin.py
@@ -221,8 +221,9 @@ class ProjectRegistrationProvider(object):
221221 pr = user.project_role()
222222 pr.roles = [ role_owner._id, role_developer._id, role_member._id ]
223223 # 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')
226227 ThreadLocalORMSession.flush_all()
227228 except:
228229 ThreadLocalORMSession.close_all()
--- a/pyforge/pyforge/tests/functional/test_neighborhood.py
+++ b/pyforge/pyforge/tests/functional/test_neighborhood.py
@@ -9,6 +9,23 @@ from pyforge.tests import TestController
99
1010 class TestNeighborhood(TestController):
1111
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+
1229 def test_admin(self):
1330 r = self.app.get('/adobe/_admin/', extra_environ=dict(username='root'))
1431 r = self.app.post('/adobe/_admin/update_acl',
--- a/pyforge/pyforge/tests/functional/test_root.py
+++ b/pyforge/pyforge/tests/functional/test_root.py
@@ -21,7 +21,7 @@ class TestRootController(TestController):
2121 response = self.app.get('/')
2222 assert response.html.find('h1').string == 'All Projects'
2323 projects = response.html.findAll('ul',{'class':'display'})[0].findAll('li')
24- assert len(projects) == 10
24+ assert len(projects) == 10, len(projects)
2525 assert projects[0].find('a').get('href') == '/adobe/'
2626 assert projects[1].find('img').get('alt') == 'adobe_1 Icon'
2727 cat_links = response.html.find('ul',{'id':'sidebarmenu'}).findAll('li')
--- a/pyforge/pyforge/tests/model/test_notification.py
+++ b/pyforge/pyforge/tests/model/test_notification.py
@@ -168,5 +168,6 @@ def _clear_subscriptions():
168168 for s in subs.subscriptions:
169169 M.Mailbox.query.remove(dict(_id=s.mailbox_id))
170170 subs.subscriptions = []
171+ M.Mailbox.query.remove({})
171172
172173
--- a/pyforge/pyforge/websetup/bootstrap.py
+++ b/pyforge/pyforge/websetup/bootstrap.py
@@ -91,9 +91,9 @@ def bootstrap(command, conf, vars):
9191 acl=dict(read=[None], create=[],
9292 moderate=[root._id], admin=[root._id]))
9393 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])
9797 M.Theme(name='forge_default',
9898 label='Default Forge Theme',
9999 color1='#0088cc',