def test_box_list_folders_returns_error_if_invalid_path( self, mock_metadata): mock_metadata.side_effect = BoxClientException( status_code=404, message='File not found') url = self.project.api_url_for('box_list_folders', folderId='lolwut') res = self.app.get(url, auth=self.user.auth, expect_errors=True) assert_equal(res.status_code, httplib.NOT_FOUND)
def test_box_user_config_get_has_invalid_credentials( self, mock_get_folder, mock_account_info): mock_account_info.side_effect = BoxClientException( 401, "The given OAuth 2 access token doesn't exist or has expired.") url = api_url_for('box_user_config_get') res = self.app.get(url, auth=self.user.auth) assert_equal(res.status_code, 200) # The JSON result result = res.json['result'] assert_false(result['validCredentials'])
def test_serialize_settings_invalid_credentials(self, mock_get_folder, mock_account_info): mock_get_folder.return_value = { 'name': 'Camera Uploads', 'path_collection': { 'entries': [{ 'name': 'All Files' }] } } mock_account_info.side_effect = BoxClientException( 401, "The given OAuth 2 access token doesn't exist or has expired.") result = serialize_settings(self.node_settings, self.user) assert_false(result['validCredentials'])