<s> import oauth2 as oauth <EOL> import urllib <EOL> import unittest <EOL> import requests <EOL> from google . appengine . ext import testbed <EOL> from main import application <EOL> from models import Service <EOL> from webtest import TestApp <EOL> class HTTPTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> base = "<STR_LIT>" <EOL> def request ( self , method , url , ** kwargs ) : <EOL> url = self . base + url <EOL> return requests . request ( method , url , ** kwargs ) <EOL> def get ( self , url , ** kwargs ) : <EOL> return self . request ( "<STR_LIT:GET>" , url , ** kwargs ) <EOL> def post ( self , url , ** kwargs ) : <EOL> return self . request ( "<STR_LIT:POST>" , url , ** kwargs ) <EOL> def put ( self , url , ** kwargs ) : <EOL> return self . request ( "<STR_LIT>" , url , ** kwargs ) <EOL> def delete ( self , url , ** kwargs ) : <EOL> return self . request ( "<STR_LIT>" , url , ** kwargs ) <EOL> def head ( self , url , ** kwargs ) : <EOL> return self . request ( "<STR_LIT>" , url , ** kwargs ) <EOL> class WSGITest ( HTTPTest ) : <EOL> """<STR_LIT>""" <EOL> def request ( self , method , url , ** kwargs ) : <EOL> return self . app . request ( method , url , ** kwargs ) <EOL> class StashboardTest ( WSGITest ) : <EOL> def setUp ( self ) : <EOL> self . app = TestApp ( application ( ) ) <EOL> self . testbed = testbed . Testbed ( ) <EOL> self . testbed . setup_env ( auth_domain = "<STR_LIT>" ) <EOL> self . authenticate ( "<STR_LIT>" , "<STR_LIT>" , admin = True ) <EOL> self . testbed . activate ( ) <EOL> self . testbed . init_memcache_stub ( ) <EOL> self . testbed . init_taskqueue_stub ( ) <EOL> self . testbed . init_datastore_v3_stub ( ) <EOL> self . testbed . init_user_stub ( ) <EOL> def authenticate ( self , name , email , admin = False ) : <EOL> admin_value = "<STR_LIT:1>" if admin else "<STR_LIT:0>" <EOL> self . testbed . setup_env ( user_is_admin = admin_value , user_email = email , <EOL> user_id = name , overwrite = True ) <EOL> def tearDown ( self ) : <EOL> self . testbed . deactivate ( ) </s>
