• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

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

allura


Commit MetaInfo

修訂a5b04ff06c696c7f9943bb192e512748f0c98620 (tree)
時間2012-05-31 04:11:55
作者bolkimen <bolkimen@yaho...>
CommiterYaroslav Luzin

Log Message

[#4208] ticket:65 fix test case

Change Summary

差異

--- a/Allura/allura/command/create_neighborhood.py
+++ b/Allura/allura/command/create_neighborhood.py
@@ -47,7 +47,7 @@ class UpdateNeighborhoodCommand(base.Command):
4747 else:
4848 home_tool_active = False
4949
50- if home_tool_active == nb.have_home_project():
50+ if home_tool_active == nb.have_home_project:
5151 return
5252
5353 p = nb.neighborhood_project
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -90,7 +90,7 @@ class NeighborhoodController(object):
9090 c.project = self.neighborhood.neighborhood_project
9191 if self.neighborhood.redirect:
9292 redirect(self.neighborhood.redirect)
93- if not self.neighborhood.have_home_project():
93+ if not self.neighborhood.have_home_project:
9494 redirect(c.project.script_name + 'wiki/')
9595 c.project_summary = W.project_summary
9696 c.page_list = W.page_list
--- a/Allura/allura/model/neighborhood.py
+++ b/Allura/allura/model/neighborhood.py
@@ -108,6 +108,7 @@ class Neighborhood(MappedClass):
108108 return self.css
109109 return ""
110110
111+ @property
111112 def have_home_project(self):
112113 if self.neighborhood_project.app_config('home') is not None:
113114 return True
--- a/Allura/allura/templates/widgets/neighborhood_overview_form.html
+++ b/Allura/allura/templates/widgets/neighborhood_overview_form.html
@@ -5,12 +5,12 @@
55 <div class="grid-14">{{widget.display_field(widget.fields.name)}}</div>
66 <label class="grid-4">Redirect</label>
77 <div class="grid-14">{{widget.display_field(widget.fields.redirect)}}</div>
8- {% if value.have_home_project() %}
8+ {% if value.have_home_project %}
99 <label class="grid-4">Home Content (HTML)</label>
1010 <div class="grid-14">{{widget.display_field(widget.fields.homepage)}}</div>
11- {% endif %}
1211 <label class="grid-4">Allow Browsing</label>
1312 <div class="grid-14">{{widget.display_field(widget.fields.allow_browse)}}</div>
13+ {% endif %}
1414 <label class="grid-4">Show Title</label>
1515 <div class="grid-14">{{widget.display_field(widget.fields.show_title)}}</div>
1616 {% if value.allow_custom_css %}
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -8,6 +8,7 @@ import Image
88 from tg import config
99 from nose.tools import assert_equal
1010 from ming.orm.ormsession import ThreadLocalORMSession
11+from paste.httpexceptions import HTTPFound
1112
1213 import allura
1314 from allura import model as M
@@ -183,6 +184,8 @@ class TestNeighborhood(TestController):
183184 neighborhood = M.Neighborhood.query.get(name='Adobe')
184185 neighborhood.features['css'] = 'picker'
185186 r = self.app.get('/adobe/')
187+ while isinstance(r.response, HTTPFound):
188+ r = r.follow()
186189 assert test_css in r
187190 r = self.app.get('/adobe/_admin/overview', extra_environ=dict(username='root'))
188191 assert custom_css in r
@@ -190,6 +193,8 @@ class TestNeighborhood(TestController):
190193 neighborhood = M.Neighborhood.query.get(name='Adobe')
191194 neighborhood.features['css'] = 'custom'
192195 r = self.app.get('/adobe/')
196+ while isinstance(r.response, HTTPFound):
197+ r = r.follow()
193198 assert test_css in r
194199 r = self.app.get('/adobe/_admin/overview', extra_environ=dict(username='root'))
195200 assert custom_css in r
@@ -242,7 +247,8 @@ class TestNeighborhood(TestController):
242247 params=dict(project_unixname='maxproject2', project_name='Max project2', project_description='', neighborhood='Projects'),
243248 antispam=True,
244249 extra_environ=dict(username='root'))
245- r = r.follow()
250+ while isinstance(r.response, HTTPFound):
251+ r = r.follow()
246252 assert 'You have exceeded the maximum number of projects' in r
247253
248254 def test_invite(self):
@@ -619,6 +625,10 @@ class TestNeighborhood(TestController):
619625 extra_environ=dict(username='root'))
620626
621627 def test_add_a_project_link(self):
628+ # Install Home tool for all neighborhoods
629+ for nb in M.Neighborhood.query.find().all():
630+ p = nb.neighborhood_project
631+ p.install_app('home', 'home', 'Home', ordinal=0)
622632 r = self.app.get('/p/')
623633 assert 'Add a Project' in r
624634 r = self.app.get('/u/', extra_environ=dict(username='test-user'))
--- a/Allura/allura/tests/functional/test_root.py
+++ b/Allura/allura/tests/functional/test_root.py
@@ -60,7 +60,12 @@ class TestRootController(TestController):
6060 assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 0
6161 assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 0
6262
63- def test_neighborhood_index(self):
63+ def test_neighborhood_home(self):
64+ # Install home app
65+ nb = M.Neighborhood.query.get(name='Adobe')
66+ p = nb.neighborhood_project
67+ p.install_app('home', 'home', 'Home', ordinal=0)
68+
6469 response = self.app.get('/adobe/')
6570 projects = response.html.findAll('div',{'class':'border card'})
6671 assert len(projects) == 2
@@ -92,4 +97,4 @@ class TestRootController(TestController):
9297
9398 def test_slash_redirect(self):
9499 r = self.app.get('/p',status=301)
95- r = self.app.get('/p/',status=200)
100+ r = self.app.get('/p/',status=302)
--- a/Allura/allura/tests/test_commands.py
+++ b/Allura/allura/tests/test_commands.py
@@ -143,10 +143,10 @@ def test_update_neighborhood():
143143 cmd.run([test_config, 'Projects', 'True'])
144144 cmd.command()
145145 nb = M.Neighborhood.query.get(name='Projects')
146- assert nb.have_home_project() == True
146+ assert nb.have_home_project == True
147147
148148 cmd = create_neighborhood.UpdateNeighborhoodCommand('update-neighborhood')
149149 cmd.run([test_config, 'Projects', 'False'])
150150 cmd.command()
151151 nb = M.Neighborhood.query.get(name='Projects')
152- assert nb.have_home_project() == False
152+ assert nb.have_home_project == False