Switch to unified view

a/Allura/allura/tests/functional/test_root.py b/Allura/allura/tests/functional/test_root.py
...
...
31
    def test_index(self):
31
    def test_index(self):
32
        response = self.app.get('/')
32
        response = self.app.get('/')
33
        assert_equal(response.html.find('h2',{'class':'dark title'}).contents[0].strip(), 'All Projects')
33
        assert_equal(response.html.find('h2',{'class':'dark title'}).contents[0].strip(), 'All Projects')
34
        projects = response.html.findAll('div',{'class':'border card'})
34
        projects = response.html.findAll('div',{'class':'border card'})
35
        assert projects[0].find('a').get('href') == '/adobe/adobe-1/'
35
        assert projects[0].find('a').get('href') == '/adobe/adobe-1/'
36
        assert projects[0].find('img').get('alt') == 'adobe-1 Logo'
37
        cat_links = response.html.find('div',{'id':'sidebar'}).findAll('li')
36
        cat_links = response.html.find('div',{'id':'sidebar'}).findAll('li')
38
        assert len(cat_links) == 4
37
        assert len(cat_links) == 4
39
        assert cat_links[0].find('a').get('href') == '/browse/clustering'
38
        assert cat_links[0].find('a').get('href') == '/browse/clustering'
40
        assert cat_links[0].find('a').find('span').string == 'Clustering'
39
        assert cat_links[0].find('a').find('span').string == 'Clustering'
41
40
...
...
50
    def test_project_browse(self):
49
    def test_project_browse(self):
51
        com_cat = M.ProjectCategory.query.find(dict(label='Communications')).first()
50
        com_cat = M.ProjectCategory.query.find(dict(label='Communications')).first()
52
        fax_cat = M.ProjectCategory.query.find(dict(label='Fax')).first()
51
        fax_cat = M.ProjectCategory.query.find(dict(label='Fax')).first()
53
        M.Project.query.find(dict(name='adobe-1')).first().category_id = com_cat._id
52
        M.Project.query.find(dict(name='adobe-1')).first().category_id = com_cat._id
54
        response = self.app.get('/browse')
53
        response = self.app.get('/browse')
55
        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 1
54
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 1
56
        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 1
55
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 1
57
        response = self.app.get('/browse/communications')
56
        response = self.app.get('/browse/communications')
58
        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 1
57
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 1
59
        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 0
58
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 0
60
        response = self.app.get('/browse/communications/fax')
59
        response = self.app.get('/browse/communications/fax')
61
        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 0
60
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 0
62
        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 0
61
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 0
63
62
64
    def test_neighborhood_index(self):
63
    def test_neighborhood_index(self):
65
        response = self.app.get('/adobe/')
64
        response = self.app.get('/adobe/')
66
        projects = response.html.findAll('div',{'class':'border card'})
65
        projects = response.html.findAll('div',{'class':'border card'})
67
        assert len(projects) == 2
66
        assert len(projects) == 2
68
        assert projects[0].find('img').get('alt') == 'adobe-1 Logo'
69
        cat_links = response.html.find('div',{'id':'sidebar'}).findAll('ul')[1].findAll('li')
67
        cat_links = response.html.find('div',{'id':'sidebar'}).findAll('ul')[1].findAll('li')
70
        assert len(cat_links) == 3, cat_links
68
        assert len(cat_links) == 3, cat_links
71
        assert cat_links[0].find('a').get('href') == '/adobe/browse/clustering'
69
        assert cat_links[0].find('a').get('href') == '/adobe/browse/clustering'
72
        assert cat_links[0].find('a').find('span').string == 'Clustering'
70
        assert cat_links[0].find('a').find('span').string == 'Clustering'
73
71
...
...
75
        com_cat = M.ProjectCategory.query.find(dict(label='Communications')).first()
73
        com_cat = M.ProjectCategory.query.find(dict(label='Communications')).first()
76
        fax_cat = M.ProjectCategory.query.find(dict(label='Fax')).first()
74
        fax_cat = M.ProjectCategory.query.find(dict(label='Fax')).first()
77
        M.Project.query.find(dict(name='adobe-1')).first().category_id = com_cat._id
75
        M.Project.query.find(dict(name='adobe-1')).first().category_id = com_cat._id
78
        M.Project.query.find(dict(name='adobe-2')).first().category_id = fax_cat._id
76
        M.Project.query.find(dict(name='adobe-2')).first().category_id = fax_cat._id
79
        response = self.app.get('/adobe/browse')
77
        response = self.app.get('/adobe/browse')
80
        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 1
78
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 1
81
        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 1
79
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 1
82
        response = self.app.get('/adobe/browse/communications')
80
        response = self.app.get('/adobe/browse/communications')
83
        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 1
81
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 1
84
        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 1
82
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 1
85
        response = self.app.get('/adobe/browse/communications/fax')
83
        response = self.app.get('/adobe/browse/communications/fax')
86
        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 0
84
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 0
87
        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 1
85
        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 1
88
86
89
    @td.with_wiki
87
    @td.with_wiki
90
    def test_markdown_to_html(self):
88
    def test_markdown_to_html(self):
91
        n = M.Neighborhood.query.get(name='Projects')
89
        n = M.Neighborhood.query.get(name='Projects')
92
        r = self.app.get('/nf/markdown_to_html?markdown=*aaa*bb[wiki:Home]&project=test&app=bugs&neighborhood=%s' % n._id, validate_chunk=True)
90
        r = self.app.get('/nf/markdown_to_html?markdown=*aaa*bb[wiki:Home]&project=test&app=bugs&neighborhood=%s' % n._id, validate_chunk=True)