def test_upload_page_notloggedin(self): AppUploadPage(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/apps/new.html -->', html)) self.assertTrue(re.search('You do not have permission to upload application. Please contact your cloud administrator', html))
def test_upload_page_loggedin(self): self.set_user('*****@*****.**') AppUploadPage(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/apps/new.html -->', html)) self.assertTrue(re.search('<input accept="tar.gz, tgz" id="app_file_data" name="app_file_data" size="30" type="file" />', html))
def test_upload_submit_loggedin(self): self.set_user('*****@*****.**') self.set_fileupload('app_file_data') AppUploadPage(self.request, self.response).post() 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/apps/new.html -->', html)) self.assertTrue(re.search('Application uploaded successfully. Please wait for the application to start running.', html))
def test_upload_submit_notloggedin(self): from dashboard import AppUploadPage self.set_fileupload('app_file_data') AppUploadPage(self.request, self.response).post() 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/apps/new.html -->', html)) self.assertTrue( re.search( 'You do not have permission to upload application. Please contact your cloud administrator', html))