From bbbcfecda38ce35b6b2396d70dce63c80a7136be Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Thu, 20 Aug 2015 14:07:57 -0700 Subject: [PATCH] Moving __author__ after imports in tests/. Both test_appengine.py and test_django_orm.py still fail E402 since they have some environment fixes during import (e.g. dev_appserver.fix_sys_path() and changes to django.conf.global_settings) --- tests/__init__.py | 5 +++-- tests/test_appengine.py | 5 +++-- tests/test_django_orm.py | 5 +++-- tests/test_file.py | 4 ++-- tests/test_flask_util.py | 5 +++-- tests/test_gce.py | 5 +++-- tests/test_jwt.py | 5 +++-- tests/test_keyring.py | 5 +++-- tests/test_oauth2client.py | 4 ++-- tests/test_util.py | 5 +++-- tests/test_xsrfutil.py | 5 +++-- 11 files changed, 31 insertions(+), 22 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 9a4adcb..bca609d 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -12,11 +12,12 @@ """Test Package set up.""" -__author__ = 'afshar@google.com (Ali Afshar)' - import oauth2client.util +__author__ = 'afshar@google.com (Ali Afshar)' + + def setup_package(): """Run on testing package.""" oauth2client.util.positional_parameters_enforcement = 'EXCEPTION' diff --git a/tests/test_appengine.py b/tests/test_appengine.py index f6c632a..57174c4 100644 --- a/tests/test_appengine.py +++ b/tests/test_appengine.py @@ -19,8 +19,6 @@ Unit tests for objects created from discovery documents. """ -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - import datetime import httplib2 import json @@ -67,6 +65,9 @@ from oauth2client.client import flow_from_clientsecrets from oauth2client.client import save_to_well_known_file from webtest import TestApp + +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') diff --git a/tests/test_django_orm.py b/tests/test_django_orm.py index 88894d1..09a2287 100644 --- a/tests/test_django_orm.py +++ b/tests/test_django_orm.py @@ -19,8 +19,6 @@ Unit tests for objects created from discovery documents. """ -__author__ = 'conleyo@google.com (Conley Owens)' - import base64 import imp import os @@ -50,6 +48,9 @@ from oauth2client.django_orm import CredentialsField from oauth2client.django_orm import FlowField +__author__ = 'conleyo@google.com (Conley Owens)' + + class TestCredentialsField(unittest.TestCase): def setUp(self): diff --git a/tests/test_file.py b/tests/test_file.py index 5162df4..ffeb537 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -19,8 +19,6 @@ Unit tests for oauth2client.file """ -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - import copy import datetime import json @@ -46,6 +44,8 @@ try: except: pass +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + FILENAME = tempfile.mktemp('oauth2client_test.data') diff --git a/tests/test_flask_util.py b/tests/test_flask_util.py index 56fa374..654b632 100644 --- a/tests/test_flask_util.py +++ b/tests/test_flask_util.py @@ -14,8 +14,6 @@ """Unit tests for the Flask utilities""" -__author__ = 'jonwayne@google.com (Jon Wayne Parrott)' - import httplib2 import json import unittest @@ -32,6 +30,9 @@ from oauth2client.flask_util import UserOAuth2 as FlaskOAuth2 from oauth2client.client import OAuth2Credentials +__author__ = 'jonwayne@google.com (Jon Wayne Parrott)' + + class Http2Mock(object): """Mock httplib2.Http for code exchange / refresh""" diff --git a/tests/test_gce.py b/tests/test_gce.py index 5fab9fc..f72e41e 100644 --- a/tests/test_gce.py +++ b/tests/test_gce.py @@ -17,8 +17,6 @@ Unit tests for oauth2client.gce. """ -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - import json from six.moves import urllib import unittest @@ -33,6 +31,9 @@ from oauth2client.client import save_to_well_known_file from oauth2client.gce import AppAssertionCredentials +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + + class AssertionCredentialsTests(unittest.TestCase): def _refresh_success_helper(self, bytes_response=False): diff --git a/tests/test_jwt.py b/tests/test_jwt.py index 53aa656..749406e 100644 --- a/tests/test_jwt.py +++ b/tests/test_jwt.py @@ -19,8 +19,6 @@ Unit tests for oauth2client. """ -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - import os import mock import sys @@ -40,6 +38,9 @@ from oauth2client import crypt from oauth2client.file import Storage +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + + def datafile(filename): f = open(os.path.join(os.path.dirname(__file__), 'data', filename), 'rb') data = f.read() diff --git a/tests/test_keyring.py b/tests/test_keyring.py index 63d2a43..dd102e9 100644 --- a/tests/test_keyring.py +++ b/tests/test_keyring.py @@ -17,8 +17,6 @@ Unit tests for oauth2client.keyring_storage. """ -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - import datetime import keyring import unittest @@ -30,6 +28,9 @@ from oauth2client.client import OAuth2Credentials from oauth2client.keyring_storage import Storage +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + + class OAuth2ClientKeyringTests(unittest.TestCase): def test_non_existent_credentials_storage(self): diff --git a/tests/test_oauth2client.py b/tests/test_oauth2client.py index 050f623..713fa61 100644 --- a/tests/test_oauth2client.py +++ b/tests/test_oauth2client.py @@ -19,8 +19,6 @@ Unit tests for oauth2client. """ -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - import base64 import contextlib import datetime @@ -81,6 +79,8 @@ from oauth2client.client import save_to_well_known_file from oauth2client.clientsecrets import _loadfile from oauth2client.service_account import _ServiceAccountCredentials +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') diff --git a/tests/test_util.py b/tests/test_util.py index f2e67f0..8b999fe 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,12 +1,13 @@ """Unit tests for oauth2client.util.""" -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - import unittest from oauth2client import util +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + + class ScopeToStringTests(unittest.TestCase): def test_iterables(self): diff --git a/tests/test_xsrfutil.py b/tests/test_xsrfutil.py index f2c61aa..50b79b4 100644 --- a/tests/test_xsrfutil.py +++ b/tests/test_xsrfutil.py @@ -16,8 +16,6 @@ Unit tests for oauth2client.xsrfutil. """ -__author__ = 'jcgregorio@google.com (Joe Gregorio)' - import unittest from oauth2client import xsrfutil @@ -33,6 +31,9 @@ TEST_EXTRA_INFO_1 = 'extra_info_1' TEST_EXTRA_INFO_2 = 'more_extra_info' +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + + class XsrfUtilTests(unittest.TestCase): """Test xsrfutil functions."""