<s> from flexmock import flexmock <EOL> import os <EOL> import re <EOL> import SOAPpy <EOL> import StringIO <EOL> import sys <EOL> import unittest <EOL> sys . path . append ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) ) <EOL> from dashboard import AppDeletePage <EOL> from dashboard import AppUploadPage <EOL> from dashboard import AuthorizePage <EOL> from dashboard import IndexPage <EOL> from dashboard import LoginPage <EOL> from dashboard import LoginVerify <EOL> from dashboard import LogoutPage <EOL> from dashboard import NewUserPage <EOL> from dashboard import StatusPage <EOL> from dashboard import StatusRefreshPage <EOL> sys . path . append ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) ) <EOL> from google . appengine . api . appcontroller_client import AppControllerClient <EOL> from google . appengine . ext import db <EOL> from google . appengine . api import taskqueue <EOL> from google . appengine . api import users <EOL> sys . path . append ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) ) <EOL> import app_dashboard_data <EOL> from app_dashboard_data import AppDashboardData <EOL> from app_dashboard_helper import AppDashboardHelper <EOL> from secret_key import GLOBAL_SECRET_KEY <EOL> class FunctionalTestAppDashboard ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> acc = flexmock ( AppControllerClient ) <EOL> acc . should_receive ( '<STR_LIT>' ) . and_return ( '<STR_LIT>' ) <EOL> acc . should_receive ( '<STR_LIT>' ) . and_return ( [ <EOL> { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : False } <EOL> } , <EOL> { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> ] ) <EOL> acc . should_receive ( '<STR_LIT>' ) . and_return ( <EOL> [ { '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , '<STR_LIT>' : '<STR_LIT>' } ] <EOL> ) <EOL> acc . should_receive ( '<STR_LIT>' ) . and_return ( <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> } <EOL> ) <EOL> acc . should_receive ( '<STR_LIT>' ) . and_return ( <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> ) <EOL> acc . should_receive ( '<STR_LIT>' ) . and_return ( '<STR_LIT:true>' ) <EOL> acc . should_receive ( '<STR_LIT>' ) . and_return ( '<STR_LIT:true>' ) <EOL> fake_soap = flexmock ( name = '<STR_LIT>' ) <EOL> soap = flexmock ( SOAPpy ) <EOL> soap . should_receive ( '<STR_LIT>' ) . and_return ( fake_soap ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . and_return ( <EOL> "<STR_LIT>" <EOL> ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' , GLOBAL_SECRET_KEY ) . and_return ( '<STR_LIT>' ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' , GLOBAL_SECRET_KEY ) . and_return ( '<STR_LIT>' ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' , GLOBAL_SECRET_KEY ) . and_return ( '<STR_LIT>' ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' , GLOBAL_SECRET_KEY ) . and_return ( <EOL> "<STR_LIT>" <EOL> ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' , GLOBAL_SECRET_KEY ) . and_return ( <EOL> "<STR_LIT>" <EOL> ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' , GLOBAL_SECRET_KEY ) . and_return ( <EOL> "<STR_LIT>" <EOL> ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . and_return ( '<STR_LIT:true>' ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . and_return ( "<STR_LIT>" ) <EOL> fake_soap . should_receive ( '<STR_LIT>' ) . and_return ( '<STR_LIT:true>' ) <EOL> self . request = self . fakeRequest ( ) <EOL> self . response = self . fakeResponse ( ) <EOL> self . set_user ( ) <EOL> fake_tq = flexmock ( taskqueue ) <EOL> fake_tq . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> self . setup_fake_db ( ) <EOL> def setup_fake_db ( self ) : <EOL> fake_root = flexmock ( ) <EOL> fake_root . head_node_ip = '<STR_LIT>' <EOL> fake_root . table = '<STR_LIT>' <EOL> fake_root . replication = '<STR_LIT>' <EOL> fake_root . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> flexmock ( app_dashboard_data ) . should_receive ( '<STR_LIT>' ) . and_return ( fake_root ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . DashboardDataRoot , <EOL> AppDashboardData . ROOT_KEYNAME ) . and_return ( None ) . and_return ( fake_root ) <EOL> fake_api1 = flexmock ( name = '<STR_LIT>' ) <EOL> fake_api1 . name = '<STR_LIT>' <EOL> fake_api1 . value = '<STR_LIT>' <EOL> fake_api1 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_api2 = flexmock ( name = '<STR_LIT>' ) <EOL> fake_api2 . name = '<STR_LIT>' <EOL> fake_api2 . value = '<STR_LIT>' <EOL> fake_api2 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_api3 = flexmock ( name = '<STR_LIT>' ) <EOL> fake_api3 . name = '<STR_LIT>' <EOL> fake_api3 . value = '<STR_LIT>' <EOL> fake_api3 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_api_q = flexmock ( ) <EOL> fake_api_q . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_api_q . should_receive ( '<STR_LIT>' ) . and_yield ( fake_api1 , fake_api2 , fake_api3 ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . APIstatus , re . compile ( '<STR_LIT>' ) ) . and_return ( fake_api1 ) . and_return ( fake_api3 ) . and_return ( fake_api3 ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . APIstatus ) . and_return ( fake_api_q ) <EOL> fake_server1 = flexmock ( name = '<STR_LIT>' ) <EOL> fake_server1 . ip = '<STR_LIT>' <EOL> fake_server1 . cpu = '<STR_LIT>' <EOL> fake_server1 . memory = '<STR_LIT>' <EOL> fake_server1 . disk = '<STR_LIT:100>' <EOL> fake_server1 . cloud = '<STR_LIT>' <EOL> fake_server1 . roles = '<STR_LIT>' <EOL> fake_server1 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_server2 = flexmock ( name = '<STR_LIT>' ) <EOL> fake_server2 . ip = '<STR_LIT>' <EOL> fake_server2 . cpu = '<STR_LIT>' <EOL> fake_server2 . memory = '<STR_LIT>' <EOL> fake_server2 . disk = '<STR_LIT:100>' <EOL> fake_server2 . cloud = '<STR_LIT>' <EOL> fake_server2 . roles = '<STR_LIT>' <EOL> fake_server2 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> flexmock ( app_dashboard_data ) . should_receive ( '<STR_LIT>' ) . and_return ( fake_server1 ) <EOL> fake_server_q = flexmock ( ) <EOL> fake_server_q . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_server_q . should_receive ( '<STR_LIT>' ) . and_yield ( fake_server1 , fake_server2 ) <EOL> fake_server_q . should_receive ( '<STR_LIT>' ) . and_return ( fake_server1 ) . and_return ( fake_server2 ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . ServerStatus ) . and_return ( fake_server_q ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . ServerStatus , re . compile ( '<STR_LIT>' ) ) . and_return ( fake_server1 ) . and_return ( fake_server2 ) <EOL> fake_app1 = flexmock ( name = '<STR_LIT>' ) <EOL> fake_app1 . name = '<STR_LIT>' <EOL> fake_app1 . url = '<STR_LIT>' <EOL> fake_app1 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_app1 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_app2 = flexmock ( name = '<STR_LIT>' ) <EOL> fake_app2 . name = '<STR_LIT>' <EOL> fake_app2 . url = None <EOL> fake_app2 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_app2 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> flexmock ( app_dashboard_data ) . should_receive ( '<STR_LIT>' ) . and_return ( fake_app1 ) <EOL> fake_app_q = flexmock ( ) <EOL> fake_app_q . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_app_q . should_receive ( '<STR_LIT>' ) . and_yield ( fake_app1 , fake_app2 ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . AppStatus ) . and_return ( fake_app_q ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . AppStatus , keys_only = True ) . and_return ( fake_app_q ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . AppStatus , re . compile ( '<STR_LIT>' ) ) . and_return ( fake_app1 ) . and_return ( fake_app2 ) <EOL> user_info1 = flexmock ( name = '<STR_LIT>' ) <EOL> user_info1 . email = '<STR_LIT>' <EOL> user_info1 . is_user_cloud_admin = True <EOL> user_info1 . can_upload_apps = True <EOL> user_info1 . owned_apps = '<STR_LIT>' <EOL> user_info1 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> user_info2 = flexmock ( name = '<STR_LIT>' ) <EOL> user_info2 . email = '<STR_LIT>' <EOL> user_info2 . is_user_cloud_admin = False <EOL> user_info2 . can_upload_apps = True <EOL> user_info2 . owned_apps = '<STR_LIT>' <EOL> user_info2 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> user_info3 = flexmock ( name = '<STR_LIT>' ) <EOL> user_info3 . email = '<STR_LIT>' <EOL> user_info3 . is_user_cloud_admin = False <EOL> user_info3 . can_upload_apps = False <EOL> user_info3 . owned_apps = '<STR_LIT>' <EOL> user_info3 . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> flexmock ( app_dashboard_data ) . should_receive ( '<STR_LIT>' ) . and_return ( user_info1 ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . UserInfo , re . compile ( '<STR_LIT>' ) ) . and_return ( user_info1 ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . UserInfo , re . compile ( '<STR_LIT>' ) ) . and_return ( user_info2 ) <EOL> flexmock ( AppDashboardData ) . should_receive ( '<STR_LIT>' ) . with_args ( app_dashboard_data . UserInfo , re . compile ( '<STR_LIT>' ) ) . and_return ( user_info3 ) <EOL> flexmock ( db ) . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> flexmock ( db ) . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> def set_user ( self , email = None ) : <EOL> self . usrs = flexmock ( users ) <EOL> if email is not None : <EOL> user_obj = flexmock ( name = '<STR_LIT>' ) <EOL> user_obj . should_receive ( '<STR_LIT:email>' ) . and_return ( email ) <EOL> self . usrs . should_receive ( '<STR_LIT>' ) . and_return ( user_obj ) <EOL> else : <EOL> self . usrs . should_receive ( '<STR_LIT>' ) . and_return ( None ) <EOL> def set_post ( self , post_dict ) : <EOL> self . request . POST = post_dict <EOL> for key in post_dict . keys ( ) : <EOL> self . request . should_receive ( '<STR_LIT>' ) . with_args ( key ) . and_return ( post_dict [ key ] ) <EOL> def set_fileupload ( self , fieldname ) : <EOL> self . request . POST = flexmock ( name = '<STR_LIT:POST>' ) <EOL> self . request . POST . multi = { } <EOL> self . request . POST . multi [ fieldname ] = flexmock ( name = '<STR_LIT:file>' ) <EOL> self . request . POST . multi [ fieldname ] . file = StringIO . StringIO ( "<STR_LIT>" ) <EOL> def set_get ( self , post_dict ) : <EOL> self . request . GET = post_dict <EOL> for key in post_dict . keys ( ) : <EOL> self . request . should_receive ( '<STR_LIT>' ) . with_args ( key ) . and_return ( post_dict [ key ] ) <EOL> def fakeRequest ( self ) : <EOL> req = flexmock ( name = '<STR_LIT>' ) <EOL> req . should_receive ( '<STR_LIT>' ) . and_return ( '<STR_LIT>' ) <EOL> req . url = '<STR_LIT:/>' <EOL> return req <EOL> def fakeResponse ( self ) : <EOL> res = flexmock ( name = '<STR_LIT>' ) <EOL> res . headers = { } <EOL> res . cookies = { } <EOL> res . deleted_cookies = { } <EOL> res . redirect_location = None <EOL> res . out = StringIO . StringIO ( ) <EOL> def fake_set_cookie ( key , value = '<STR_LIT>' , max_age = None , path = '<STR_LIT:/>' , domain = None , <EOL> secure = None , httponly = False , comment = None , expires = None , overwrite = False ) : <EOL> res . cookies [ key ] = value <EOL> def fake_delete_cookie ( key , path = '<STR_LIT:/>' , domain = None ) : <EOL> res . deleted_cookies [ key ] = <NUM_LIT:1> <EOL> def fake_clear ( ) : pass <EOL> def fake_redirect ( path , response ) : <EOL> res . redirect_location = path <EOL> res . set_cookie = fake_set_cookie <EOL> res . delete_cookie = fake_delete_cookie <EOL> res . clear = fake_clear <EOL> res . redirect = fake_redirect <EOL> return res <EOL> def test_landing_notloggedin ( self ) : <EOL> IndexPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertFalse ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_landing_loggedin_notAdmin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> IndexPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertFalse ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_landing_loggedin_isAdmin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> IndexPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_status_notloggedin_refresh ( self ) : <EOL> self . set_get ( { <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> } ) <EOL> StatusPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_status_notloggedin ( self ) : <EOL> StatusPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_status_loggedin_notAdmin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> StatusPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertFalse ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_status_loggedin_isAdmin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> StatusPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_newuser_page ( self ) : <EOL> NewUserPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_newuser_bademail ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } ) <EOL> NewUserPage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_newuser_shortpasswd ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } ) <EOL> NewUserPage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_newuser_passwdnomatch ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } ) <EOL> NewUserPage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_newuser_success ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } ) <EOL> page = NewUserPage ( self . request , self . response ) <EOL> page . redirect = self . response . redirect <EOL> page . post ( ) <EOL> self . assertTrue ( AppDashboardHelper . DEV_APPSERVER_LOGIN_COOKIE in self . response . cookies ) <EOL> self . assertEqual ( self . response . redirect_location , '<STR_LIT:/>' ) <EOL> def test_loginverify_page ( self ) : <EOL> self . set_get ( { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> LoginVerify ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_loginverify_submitcontinue ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> page = LoginVerify ( self . request , self . response ) <EOL> page . redirect = self . response . redirect <EOL> page . post ( ) <EOL> self . assertEqual ( self . response . redirect_location , '<STR_LIT>' ) <EOL> def test_loginverify_submitnocontinue ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> page = LoginVerify ( self . request , self . response ) <EOL> page . redirect = self . response . redirect <EOL> page . post ( ) <EOL> self . assertEqual ( self . response . redirect_location , '<STR_LIT:/>' ) <EOL> def test_logout_page ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> page = LogoutPage ( self . request , self . response ) <EOL> page . redirect = self . response . redirect <EOL> page . get ( ) <EOL> self . assertEqual ( self . response . redirect_location , '<STR_LIT:/>' ) <EOL> self . assertTrue ( AppDashboardHelper . DEV_APPSERVER_LOGIN_COOKIE in self . response . deleted_cookies ) <EOL> def test_login_page ( self ) : <EOL> continue_url = '<STR_LIT>' <EOL> self . set_get ( { <EOL> '<STR_LIT>' : continue_url <EOL> } ) <EOL> LoginPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( continue_url , html ) ) <EOL> def test_login_success ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> page = LoginPage ( self . request , self . response ) <EOL> page . redirect = self . response . redirect <EOL> page . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertEqual ( self . response . redirect_location , '<STR_LIT:/>' ) <EOL> self . assertTrue ( AppDashboardHelper . DEV_APPSERVER_LOGIN_COOKIE in self . response . cookies ) <EOL> def test_login_success_redir ( self ) : <EOL> continue_url = '<STR_LIT>' <EOL> self . set_post ( { <EOL> '<STR_LIT>' : continue_url , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> page = LoginPage ( self . request , self . response ) <EOL> page . redirect = self . response . redirect <EOL> page . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , self . response . redirect_location ) ) <EOL> self . assertTrue ( AppDashboardHelper . DEV_APPSERVER_LOGIN_COOKIE in self . response . cookies ) <EOL> def test_login_fail ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> page = LoginPage ( self . request , self . response ) <EOL> page . redirect = self . response . redirect <EOL> page . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_authorize_page_notloggedin ( self ) : <EOL> AuthorizePage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_authorize_page_loggedin_notadmin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> AuthorizePage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_authorize_page_loggedin_admin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> AuthorizePage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_authorize_submit_notloggedin ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:True>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:True>' , <EOL> } ) <EOL> AuthorizePage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_authorize_submit_notadmin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:True>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:True>' , <EOL> } ) <EOL> AuthorizePage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_authorize_submit_remove ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:True>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:True>' , <EOL> } ) <EOL> AuthorizePage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_authorize_submit_add ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:True>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:False>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } ) <EOL> AuthorizePage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_upload_page_notloggedin ( self ) : <EOL> AppUploadPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_upload_page_loggedin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> AppUploadPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_upload_submit_notloggedin ( self ) : <EOL> self . set_fileupload ( '<STR_LIT>' ) <EOL> AppUploadPage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_upload_submit_loggedin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> self . set_fileupload ( '<STR_LIT>' ) <EOL> AppUploadPage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_appdelete_page_nologgedin ( self ) : <EOL> AppDeletePage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertFalse ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_appdelete_page_loggedin_twoapps ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> AppDeletePage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_appdelete_page_loggedin_oneapp ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> AppDeletePage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertFalse ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_appdelete_submit_notloggedin ( self ) : <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> AppDeletePage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_appdelete_submit_notappadmin ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> AppDeletePage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_appdelete_submit_success ( self ) : <EOL> self . set_user ( '<STR_LIT>' ) <EOL> self . set_post ( { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> AppDeletePage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_refresh_data_get ( self ) : <EOL> StatusRefreshPage ( self . request , self . response ) . get ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) <EOL> def test_refresh_data_post ( self ) : <EOL> StatusRefreshPage ( self . request , self . response ) . post ( ) <EOL> html = self . response . out . getvalue ( ) <EOL> self . assertTrue ( re . search ( '<STR_LIT>' , html ) ) </s>
