<s> import mock <EOL> from nose . tools import * <EOL> from website . addons . base . testing import views <EOL> from website . addons . googledrive . client import GoogleDriveClient <EOL> from website . addons . googledrive . serializer import GoogleDriveSerializer <EOL> from website . addons . googledrive . tests . utils import mock_folders as sample_folder_data <EOL> from website . addons . googledrive . tests . utils import GoogleDriveAddonTestCase <EOL> class TestAuthViews ( GoogleDriveAddonTestCase , views . OAuthAddonAuthViewsTestCaseMixin ) : <EOL> pass <EOL> class TestConfigViews ( GoogleDriveAddonTestCase , views . OAuthAddonConfigViewsTestCaseMixin ) : <EOL> folder = { <EOL> '<STR_LIT:path>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : '<STR_LIT>' <EOL> } <EOL> Serializer = GoogleDriveSerializer <EOL> client = GoogleDriveClient <EOL> def setUp ( self ) : <EOL> super ( TestConfigViews , self ) . setUp ( ) <EOL> self . mock_about = mock . patch . object ( <EOL> GoogleDriveClient , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . mock_about . return_value = { '<STR_LIT>' : '<STR_LIT>' } <EOL> self . mock_about . start ( ) <EOL> self . mock_fetch = mock . patch . object ( <EOL> self . node_settings . __class__ , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . mock_fetch . return_value = self . external_account . oauth_key <EOL> self . mock_fetch . start ( ) <EOL> def tearDown ( self ) : <EOL> self . mock_about . stop ( ) <EOL> self . mock_fetch . stop ( ) <EOL> super ( TestConfigViews , self ) . tearDown ( ) <EOL> @ mock . patch . object ( GoogleDriveClient , '<STR_LIT>' ) <EOL> def test_folder_list_not_root ( self , mock_drive_client_folders ) : <EOL> mock_drive_client_folders . return_value = sample_folder_data [ '<STR_LIT>' ] <EOL> folderId = '<STR_LIT>' <EOL> self . node_settings . set_auth ( external_account = self . external_account , user = self . user ) <EOL> self . node_settings . save ( ) <EOL> url = self . project . api_url_for ( '<STR_LIT>' , folderId = folderId ) <EOL> res = self . app . get ( url , auth = self . user . auth ) <EOL> assert_equal ( res . status_code , <NUM_LIT:200> ) <EOL> assert_equal ( len ( res . json ) , len ( sample_folder_data [ '<STR_LIT>' ] ) ) <EOL> @ mock . patch . object ( GoogleDriveClient , '<STR_LIT>' ) <EOL> def test_folder_list ( self , mock_about ) : <EOL> mock_about . return_value = { '<STR_LIT>' : '<STR_LIT>' } <EOL> super ( TestConfigViews , self ) . test_folder_list ( ) </s>
