Parent: [67df1e] (diff)

Child: [bf9d35] (diff)

Download this file

test_home.py    58 lines (49 with data), 2.2 kB

 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
from pylons import g
from formencode.variabledecode import variable_encode
from ming.orm.ormsession import ThreadLocalORMSession
from allura.tests import TestController
from allura import model as M
class TestProjectHome(TestController):
def test_project_nav(self):
response = self.app.get('/p/test/_nav.json')
root = self.app.get('/p/test/home/')
nav_links = root.html.find('div', dict(id='top_nav')).findAll('a')
assert len(nav_links) == len(response.json['menu'])
for nl, entry in zip(nav_links, response.json['menu']):
assert nl['href'] == entry['url']
def test_home(self):
r0 = self.app.get('/home/').body
r = self.app.get('/home/configuration')
selects = r.html.findAll('select')
options = selects[-1].findAll('option')
wnames = [
o['value'] for o in options ]
params = variable_encode(dict(
divs=[
dict(name='content',
content=[ dict(widget=wn) for wn in wnames ])
]))
self.app.post('/home/update_configuration', params=params)
r1 = self.app.get('/home/').body
assert r0 != r1
def test_neighborhood_home(self):
r0 = self.app.get('/p/test/home/').body
r1 = self.app.get('/adobe/test/home/', status=302)
r2 = self.app.get('/adobe/no_such_project/home/', status=404)
r = self.app.get('/p/test/home/configuration')
selects = r.html.findAll('select')
options = selects[-1].findAll('option')
wnames = [
o['value'] for o in options ]
params = variable_encode(dict(
divs=[
dict(name='content',
content=[ dict(widget=wn) for wn in wnames ])
]))
self.app.post('/p/test/home/update_configuration', params=params)
r1 = self.app.get('/home/').body
assert r0 != r1
def test_user_subproject_home_not_profile(self):
r = self.app.get('/u/test-admin/sub1/')
assert r.location.endswith('home/'), r.location
r.follow()