Child: [959395] (diff)

Download this file

test_site_admin.py    40 lines (33 with data), 1.6 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
import os, allura
from allura.tests import TestController
class TestSiteAdmin(TestController):
def test_home(self):
r = self.app.get('/nf/admin/', extra_environ=dict(
username='root'))
assert 'Forge Site Admin' in r.html.find('h2',{'class':'dark title'}).contents[0]
stats_table = r.html.find('table')
cells = stats_table.findAll('td')
assert cells[0].contents[0] == 'Users'
def test_performance(self):
r = self.app.get('/nf/admin/stats', extra_environ=dict(
username='root'))
assert 'Forge Site Admin' in r.html.find('h2',{'class':'dark title'}).contents[0]
stats_table = r.html.find('table')
headers = stats_table.findAll('th')
assert headers[0].contents[0] == 'Url'
assert headers[1].contents[0] == 'Ming'
assert headers[2].contents[0] == 'Mongo'
assert headers[3].contents[0] == 'Render'
assert headers[4].contents[0] == 'Template'
assert headers[5].contents[0] == 'Total Time'
def test_cpa(self):
r = self.app.get('/nf/admin/cpa_stats', extra_environ=dict(
username='root'))
assert 'Forge Site Admin' in r.html.find('h2',{'class':'dark title'}).contents[0]
stats_table = r.html.find('table')
headers = stats_table.findAll('th')
assert headers[0].contents[0] == 'Tool Name'
assert headers[1].contents[0] == 'Class Name'
assert headers[2].contents[0] == 'Create'
assert headers[3].contents[0] == 'Modify'
assert headers[4].contents[0] == 'Delete'