def test_status_notloggedin(self): StatusPage(self.request, self.response).get() html = self.response.out.getvalue() self.assertTrue(re.search('<!-- FILE:templates/layouts/main.html -->', html)) self.assertTrue(re.search('<!-- FILE:templates/shared/navigation.html -->', html)) self.assertTrue(re.search('<!-- FILE:templates/status/cloud.html -->', html)) self.assertTrue(re.search('<a href="/users/login">Login</a>', html))
def test_status_loggedin_isAdmin(self): self.set_user('*****@*****.**') StatusPage(self.request, self.response).get() html = self.response.out.getvalue() self.assertTrue(re.search('<!-- FILE:templates/layouts/main.html -->', html)) self.assertTrue(re.search('<!-- FILE:templates/shared/navigation.html -->', html)) self.assertTrue(re.search('<!-- FILE:templates/status/cloud.html -->', html)) self.assertTrue(re.search('<a href="/users/logout">Logout</a>', html)) self.assertTrue(re.search('<span>CPU / Memory Usage', html))
def test_status_notloggedin_refresh(self): from dashboard import StatusPage self.set_get({ 'forcerefresh': '1', }) StatusPage(self.request, self.response).get() html = self.response.out.getvalue() self.assertTrue( re.search('<!-- FILE:templates/layouts/main.html -->', html)) self.assertTrue( re.search('<!-- FILE:templates/shared/navigation.html -->', html)) self.assertTrue( re.search('<!-- FILE:templates/status/cloud.html -->', html)) self.assertTrue(re.search('<a href="/users/login">Login</a>', html))