diff --git a/docs/source/oauth2client.appengine.rst b/docs/source/oauth2client.appengine.rst deleted file mode 100644 index dfb217f..0000000 --- a/docs/source/oauth2client.appengine.rst +++ /dev/null @@ -1,7 +0,0 @@ -oauth2client.appengine module -============================= - -.. automodule:: oauth2client.appengine - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/oauth2client.contrib.appengine.rst b/docs/source/oauth2client.contrib.appengine.rst new file mode 100644 index 0000000..7f3d5e2 --- /dev/null +++ b/docs/source/oauth2client.contrib.appengine.rst @@ -0,0 +1,7 @@ +oauth2client.contrib.appengine module +===================================== + +.. automodule:: oauth2client.contrib.appengine + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/oauth2client.contrib.django_orm.rst b/docs/source/oauth2client.contrib.django_orm.rst new file mode 100644 index 0000000..e4d1656 --- /dev/null +++ b/docs/source/oauth2client.contrib.django_orm.rst @@ -0,0 +1,7 @@ +oauth2client.contrib.django_orm module +====================================== + +.. automodule:: oauth2client.contrib.django_orm + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/oauth2client.contrib.flask_util.rst b/docs/source/oauth2client.contrib.flask_util.rst new file mode 100644 index 0000000..8ff2355 --- /dev/null +++ b/docs/source/oauth2client.contrib.flask_util.rst @@ -0,0 +1,7 @@ +oauth2client.contrib.flask_util module +====================================== + +.. automodule:: oauth2client.contrib.flask_util + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/oauth2client.contrib.keyring_storage.rst b/docs/source/oauth2client.contrib.keyring_storage.rst new file mode 100644 index 0000000..0fd7476 --- /dev/null +++ b/docs/source/oauth2client.contrib.keyring_storage.rst @@ -0,0 +1,7 @@ +oauth2client.contrib.keyring_storage module +=========================================== + +.. automodule:: oauth2client.contrib.keyring_storage + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/oauth2client.contrib.locked_file.rst b/docs/source/oauth2client.contrib.locked_file.rst new file mode 100644 index 0000000..1076e29 --- /dev/null +++ b/docs/source/oauth2client.contrib.locked_file.rst @@ -0,0 +1,7 @@ +oauth2client.contrib.locked_file module +======================================= + +.. automodule:: oauth2client.contrib.locked_file + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/oauth2client.contrib.multistore_file.rst b/docs/source/oauth2client.contrib.multistore_file.rst new file mode 100644 index 0000000..2787b10 --- /dev/null +++ b/docs/source/oauth2client.contrib.multistore_file.rst @@ -0,0 +1,7 @@ +oauth2client.contrib.multistore_file module +=========================================== + +.. automodule:: oauth2client.contrib.multistore_file + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/oauth2client.contrib.rst b/docs/source/oauth2client.contrib.rst index 96d0f2f..f90c16f 100644 --- a/docs/source/oauth2client.contrib.rst +++ b/docs/source/oauth2client.contrib.rst @@ -8,6 +8,18 @@ Subpackages oauth2client.contrib.django_util +Submodules +---------- + +.. toctree:: + + oauth2client.contrib.appengine + oauth2client.contrib.django_orm + oauth2client.contrib.flask_util + oauth2client.contrib.keyring_storage + oauth2client.contrib.locked_file + oauth2client.contrib.multistore_file + Module contents --------------- diff --git a/docs/source/oauth2client.django_orm.rst b/docs/source/oauth2client.django_orm.rst deleted file mode 100644 index 92efc4f..0000000 --- a/docs/source/oauth2client.django_orm.rst +++ /dev/null @@ -1,7 +0,0 @@ -oauth2client.django_orm module -============================== - -.. automodule:: oauth2client.django_orm - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/oauth2client.flask_util.rst b/docs/source/oauth2client.flask_util.rst deleted file mode 100644 index 4282f94..0000000 --- a/docs/source/oauth2client.flask_util.rst +++ /dev/null @@ -1,7 +0,0 @@ -oauth2client.flask_util module -============================== - -.. automodule:: oauth2client.flask_util - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/oauth2client.keyring_storage.rst b/docs/source/oauth2client.keyring_storage.rst deleted file mode 100644 index 93d0954..0000000 --- a/docs/source/oauth2client.keyring_storage.rst +++ /dev/null @@ -1,7 +0,0 @@ -oauth2client.keyring_storage module -=================================== - -.. automodule:: oauth2client.keyring_storage - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/oauth2client.locked_file.rst b/docs/source/oauth2client.locked_file.rst deleted file mode 100644 index bd6fb5f..0000000 --- a/docs/source/oauth2client.locked_file.rst +++ /dev/null @@ -1,7 +0,0 @@ -oauth2client.locked_file module -=============================== - -.. automodule:: oauth2client.locked_file - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/oauth2client.multistore_file.rst b/docs/source/oauth2client.multistore_file.rst deleted file mode 100644 index 58d6afd..0000000 --- a/docs/source/oauth2client.multistore_file.rst +++ /dev/null @@ -1,7 +0,0 @@ -oauth2client.multistore_file module -=================================== - -.. automodule:: oauth2client.multistore_file - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/oauth2client.rst b/docs/source/oauth2client.rst index d1c7c3f..09ef81b 100644 --- a/docs/source/oauth2client.rst +++ b/docs/source/oauth2client.rst @@ -13,18 +13,12 @@ Submodules .. toctree:: - oauth2client.appengine oauth2client.client oauth2client.clientsecrets oauth2client.crypt oauth2client.devshell - oauth2client.django_orm oauth2client.file - oauth2client.flask_util oauth2client.gce - oauth2client.keyring_storage - oauth2client.locked_file - oauth2client.multistore_file oauth2client.service_account oauth2client.tools oauth2client.util diff --git a/oauth2client/appengine.py b/oauth2client/contrib/appengine.py similarity index 100% rename from oauth2client/appengine.py rename to oauth2client/contrib/appengine.py diff --git a/oauth2client/django_orm.py b/oauth2client/contrib/django_orm.py similarity index 100% rename from oauth2client/django_orm.py rename to oauth2client/contrib/django_orm.py diff --git a/oauth2client/contrib/django_util/__init__.py b/oauth2client/contrib/django_util/__init__.py index 7b5d6c6..7818cb0 100644 --- a/oauth2client/contrib/django_util/__init__.py +++ b/oauth2client/contrib/django_util/__init__.py @@ -163,9 +163,6 @@ oauth2_authorized signal: """ -import sys - - import django.conf from django.core import exceptions from django.core import urlresolvers @@ -235,7 +232,7 @@ class OAuth2Settings(object): _get_oauth2_client_id_and_secret(settings_instance) if ('django.contrib.sessions.middleware.SessionMiddleware' - not in settings_instance.MIDDLEWARE_CLASSES): + not in settings_instance.MIDDLEWARE_CLASSES): raise exceptions.ImproperlyConfigured( "The Google OAuth2 Helper requires session middleware to " "be installed. Edit your MIDDLEWARE_CLASSES setting" @@ -292,8 +289,8 @@ class UserOAuth2(object): def has_credentials(self): """Returns True if there are valid credentials for the current user and required scopes.""" - return self.credentials and not self.credentials.invalid \ - and self.credentials.has_scopes(self.scopes) + return (self.credentials and not self.credentials.invalid + and self.credentials.has_scopes(self.scopes)) @property def credentials(self): diff --git a/oauth2client/contrib/django_util/apps.py b/oauth2client/contrib/django_util/apps.py index 4e3a835..7fa20ab 100644 --- a/oauth2client/contrib/django_util/apps.py +++ b/oauth2client/contrib/django_util/apps.py @@ -25,6 +25,7 @@ import sys # Django 1.7+ only supports Python 2.7+ if sys.hexversion >= 0x02070000: # pragma: NO COVER from django.apps import AppConfig + class GoogleOAuth2HelperConfig(AppConfig): """ App Config for Django Helper""" name = 'oauth2client.django_util' diff --git a/oauth2client/flask_util.py b/oauth2client/contrib/flask_util.py similarity index 99% rename from oauth2client/flask_util.py rename to oauth2client/contrib/flask_util.py index 52eea3e..8b03d87 100644 --- a/oauth2client/flask_util.py +++ b/oauth2client/contrib/flask_util.py @@ -29,7 +29,7 @@ apiui/credential>`__. .. code-block:: python - from oauth2client.flask_util import UserOAuth2 + from oauth2client.contrib.flask_util import UserOAuth2 app = Flask(__name__) @@ -218,10 +218,11 @@ class UserOAuth2(object): file, obtained from the credentials screen in the Google Developers console. * ``GOOGLE_OAUTH2_CLIENT_ID`` the oauth2 credentials' client ID. This - is only needed if ``GOOGLE_OAUTH2_CLIENT_SECRETS_JSON`` is not specified. - * ``GOOGLE_OAUTH2_CLIENT_SECRET`` the oauth2 credentials' client - secret. This is only needed if ``GOOGLE_OAUTH2_CLIENT_SECRETS_JSON`` is not + is only needed if ``GOOGLE_OAUTH2_CLIENT_SECRETS_JSON`` is not specified. + * ``GOOGLE_OAUTH2_CLIENT_SECRET`` the oauth2 credentials' client + secret. This is only needed if ``GOOGLE_OAUTH2_CLIENT_SECRETS_JSON`` + is not specified. If app is specified, all arguments will be passed along to init_app. @@ -243,7 +244,8 @@ class UserOAuth2(object): app: A Flask application. scopes: Optional list of scopes to authorize. client_secrets_file: Path to a file containing client secrets. You - can also specify the GOOGLE_OAUTH2_CLIENT_SECRETS_JSON config value. + can also specify the GOOGLE_OAUTH2_CLIENT_SECRETS_JSON config + value. client_id: If not specifying a client secrets file, specify the OAuth2 client id. You can also specify the GOOGLE_OAUTH2_CLIENT_ID config value. You must also provide a diff --git a/oauth2client/keyring_storage.py b/oauth2client/contrib/keyring_storage.py similarity index 100% rename from oauth2client/keyring_storage.py rename to oauth2client/contrib/keyring_storage.py diff --git a/oauth2client/locked_file.py b/oauth2client/contrib/locked_file.py similarity index 100% rename from oauth2client/locked_file.py rename to oauth2client/contrib/locked_file.py diff --git a/oauth2client/multistore_file.py b/oauth2client/contrib/multistore_file.py similarity index 99% rename from oauth2client/multistore_file.py rename to oauth2client/contrib/multistore_file.py index 5a12797..13bd440 100644 --- a/oauth2client/multistore_file.py +++ b/oauth2client/contrib/multistore_file.py @@ -53,7 +53,7 @@ import threading from oauth2client.client import Credentials from oauth2client.client import Storage as BaseStorage from oauth2client import util -from oauth2client.locked_file import LockedFile +from oauth2client.contrib.locked_file import LockedFile __author__ = 'jbeda@google.com (Joe Beda)' diff --git a/tests/contrib/__init__.py b/tests/contrib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_appengine.py b/tests/contrib/test_appengine.py similarity index 98% rename from tests/test_appengine.py rename to tests/contrib/test_appengine.py index a20ddfe..184e8f7 100644 --- a/tests/test_appengine.py +++ b/tests/contrib/test_appengine.py @@ -34,7 +34,7 @@ dev_appserver.fix_sys_path() import mock import webapp2 -from .http_mock import CacheMock +from ..http_mock import CacheMock from google.appengine.api import apiproxy_stub from google.appengine.api import apiproxy_stub_map from google.appengine.api import app_identity @@ -44,18 +44,18 @@ from google.appengine.api.memcache import memcache_stub from google.appengine.ext import db from google.appengine.ext import ndb from google.appengine.ext import testbed -from oauth2client import appengine +from oauth2client.contrib import appengine from oauth2client import GOOGLE_TOKEN_URI from oauth2client.clientsecrets import _loadfile from oauth2client.clientsecrets import InvalidClientSecretsError -from oauth2client.appengine import AppAssertionCredentials -from oauth2client.appengine import CredentialsModel -from oauth2client.appengine import CredentialsNDBModel -from oauth2client.appengine import FlowNDBProperty -from oauth2client.appengine import FlowProperty -from oauth2client.appengine import OAuth2Decorator -from oauth2client.appengine import OAuth2DecoratorFromClientSecrets -from oauth2client.appengine import StorageByKeyName +from oauth2client.contrib.appengine import AppAssertionCredentials +from oauth2client.contrib.appengine import CredentialsModel +from oauth2client.contrib.appengine import CredentialsNDBModel +from oauth2client.contrib.appengine import FlowNDBProperty +from oauth2client.contrib.appengine import FlowProperty +from oauth2client.contrib.appengine import OAuth2Decorator +from oauth2client.contrib.appengine import OAuth2DecoratorFromClientSecrets +from oauth2client.contrib.appengine import StorageByKeyName from oauth2client.client import _CLOUDSDK_CONFIG_ENV_VAR from oauth2client.client import AccessTokenRefreshError from oauth2client.client import Credentials @@ -67,7 +67,7 @@ from webtest import TestApp __author__ = 'jcgregorio@google.com (Joe Gregorio)' -DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') +DATA_DIR = os.path.join(os.path.dirname(__file__), '..', 'data') def datafile(filename): diff --git a/tests/test_django_orm.py b/tests/contrib/test_django_orm.py similarity index 93% rename from tests/test_django_orm.py rename to tests/contrib/test_django_orm.py index fba9a25..8e8c5f4 100644 --- a/tests/test_django_orm.py +++ b/tests/contrib/test_django_orm.py @@ -29,11 +29,11 @@ import unittest # Mock a Django environment from django.conf import global_settings -os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_django_settings' +os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.contrib.test_django_settings' from django.conf import settings settings.SECRET_KEY = 'this string is not a real Django SECRET_KEY' -settings.INSTALLED_APPS = ['tests.test_django_orm'] +settings.INSTALLED_APPS = ['tests.contrib.test_django_orm'] import django @@ -43,7 +43,7 @@ from django.apps import AppConfig class DjangoOrmTestApp(AppConfig): """App Config for Django Helper.""" - name = 'oauth2client.tests.test_django_orm' + name = 'oauth2client.tests.contrib.test_django_orm' verbose_name = "Django Test App" @@ -52,9 +52,9 @@ from oauth2client._helpers import _from_bytes from oauth2client.client import Credentials from oauth2client.client import Flow from oauth2client.client import OAuth2Credentials -from oauth2client.django_orm import CredentialsField -from oauth2client.django_orm import FlowField -from oauth2client.django_orm import Storage +from oauth2client.contrib.django_orm import CredentialsField +from oauth2client.contrib.django_orm import FlowField +from oauth2client.contrib.django_orm import Storage from oauth2client import GOOGLE_TOKEN_URI __author__ = 'conleyo@google.com (Conley Owens)' diff --git a/tests/test_django_settings.py b/tests/contrib/test_django_settings.py similarity index 95% rename from tests/test_django_settings.py rename to tests/contrib/test_django_settings.py index 4565fc8..cd4ffd5 100644 --- a/tests/test_django_settings.py +++ b/tests/contrib/test_django_settings.py @@ -31,4 +31,4 @@ GOOGLE_OAUTH2_CLIENT_ID = 'client_id2' GOOGLE_OAUTH2_CLIENT_SECRET = 'hunter2' GOOGLE_OAUTH2_SCOPES = ('https://www.googleapis.com/auth/cloud-platform',) -ROOT_URLCONF = 'tests.test_django_util' +ROOT_URLCONF = 'tests.contrib.test_django_util' diff --git a/tests/test_django_util.py b/tests/contrib/test_django_util.py similarity index 92% rename from tests/test_django_util.py rename to tests/contrib/test_django_util.py index e09c437..6a8567c 100644 --- a/tests/test_django_util.py +++ b/tests/contrib/test_django_util.py @@ -65,8 +65,11 @@ class OAuth2SetupTest(unittest.TestCase): } ) - self.assertRaises(ValueError, django_util.OAuth2Settings.__init__, - object.__new__(django_util.OAuth2Settings), django.conf.settings) + self.assertRaises( + ValueError, + django_util.OAuth2Settings.__init__, + object.__new__(django_util.OAuth2Settings), + django.conf.settings) @mock.patch("oauth2client.contrib.django_util.clientsecrets") def test_no_settings(self, clientsecrets): @@ -74,18 +77,22 @@ class OAuth2SetupTest(unittest.TestCase): django.conf.settings.GOOGLE_OAUTH2_CLIENT_SECRET = None django.conf.settings.GOOGLE_OAUTH2_CLIENT_ID = None - self.assertRaises(exceptions.ImproperlyConfigured, django_util.OAuth2Settings.__init__, - object.__new__(django_util.OAuth2Settings), django.conf.settings) + self.assertRaises( + exceptions.ImproperlyConfigured, + django_util.OAuth2Settings.__init__, + object.__new__(django_util.OAuth2Settings), + django.conf.settings) @mock.patch("oauth2client.contrib.django_util.clientsecrets") def test_no_session_middleware(self, clientsecrets): old_classes = django.conf.settings.MIDDLEWARE_CLASSES django.conf.settings.MIDDLEWARE_CLASSES = () - self.assertRaises(exceptions.ImproperlyConfigured, - django_util.OAuth2Settings.__init__, object.__new__( - django_util.OAuth2Settings), - django.conf.settings) + self.assertRaises( + exceptions.ImproperlyConfigured, + django_util.OAuth2Settings.__init__, + object.__new__(django_util.OAuth2Settings), + django.conf.settings) django.conf.settings.MIDDLEWARE_CLASSES = old_classes @@ -114,7 +121,6 @@ class OAuth2EnabledDecoratorTest(TestWithSession): self.assertFalse(request.oauth.has_credentials()) self.assertIsNone(request.oauth.http) - @mock.patch("oauth2client.client.OAuth2Credentials") def test_has_credentials_in_storage(self, OAuth2Credentials): request = self.factory.get('/test') @@ -170,7 +176,8 @@ class OAuth2RequiredDecoratorTest(TestWithSession): self.assertTrue(isinstance(response, http.HttpResponseRedirect)) self.assertEquals(parse.urlparse(response['Location']).path, "/oauth2/oauth2authorize/") - self.assertTrue("return_url=%2Ftest" in parse.urlparse(response['Location']).query) + self.assertTrue( + "return_url=%2Ftest" in parse.urlparse(response['Location']).query) self.assertEquals(response.status_code, 302) @@ -179,7 +186,6 @@ class OAuth2RequiredDecoratorTest(TestWithSession): request = self.factory.get('/test') request.session = mock.MagicMock() - @decorators.oauth_required def test_view(request): return http.HttpResponse("test") @@ -198,7 +204,8 @@ class OAuth2RequiredDecoratorTest(TestWithSession): request = self.factory.get('/test') request.session = mock.MagicMock() - credentials_mock = mock.Mock(scopes=set(django.conf.settings.GOOGLE_OAUTH2_SCOPES)) + credentials_mock = mock.Mock( + scopes=set(django.conf.settings.GOOGLE_OAUTH2_SCOPES)) credentials_mock.has_scopes.return_value = False OAuth2Credentials.from_json.return_value = credentials_mock @@ -215,13 +222,14 @@ class OAuth2RequiredDecoratorTest(TestWithSession): request = self.factory.get('/test') request.session = mock.MagicMock() - credentials_mock = mock.Mock(scopes=set(django.conf.settings.GOOGLE_OAUTH2_SCOPES)) + credentials_mock = mock.Mock( + scopes=set(django.conf.settings.GOOGLE_OAUTH2_SCOPES)) credentials_mock.has_scopes = False OAuth2Credentials.from_json.return_value = credentials_mock @decorators.oauth_required(scopes=['additional-scope']) def test_view(request): - return http.HttpResponse("hello world") # pragma: NO COVER + return http.HttpResponse("hello world") # pragma: NO COVER response = test_view(request) self.assertEquals(response.status_code, 302) @@ -243,6 +251,7 @@ class Oauth2AuthorizeTest(TestWithSession): response = views.oauth2_authorize(request) self.assertTrue(isinstance(response, http.HttpResponseRedirect)) + class Oauth2CallbackTest(TestWithSession): def setUp(self): @@ -331,7 +340,8 @@ class Oauth2CallbackTest(TestWithSession): request.session = self.session response = views.oauth2_callback(request) self.assertTrue(isinstance(response, http.HttpResponseBadRequest)) - self.assertEquals(response.content, b'No existing session for this flow.') + self.assertEquals( + response.content, b'No existing session for this flow.') def test_missing_state_returns_bad_request(self): request = self.factory.get('oauth2/oauth2callback', data={ diff --git a/tests/test_flask_util.py b/tests/contrib/test_flask_util.py similarity index 99% rename from tests/test_flask_util.py rename to tests/contrib/test_flask_util.py index 5ceb7b7..0395ab9 100644 --- a/tests/test_flask_util.py +++ b/tests/contrib/test_flask_util.py @@ -26,8 +26,8 @@ import six.moves.urllib.parse as urlparse from oauth2client import GOOGLE_AUTH_URI from oauth2client import GOOGLE_TOKEN_URI from oauth2client import clientsecrets -from oauth2client.flask_util import _get_flow_for_token -from oauth2client.flask_util import UserOAuth2 as FlaskOAuth2 +from oauth2client.contrib.flask_util import _get_flow_for_token +from oauth2client.contrib.flask_util import UserOAuth2 as FlaskOAuth2 from oauth2client.client import OAuth2Credentials diff --git a/tests/test_keyring_storage.py b/tests/contrib/test_keyring_storage.py similarity index 96% rename from tests/test_keyring_storage.py rename to tests/contrib/test_keyring_storage.py index 5e7d0bc..500acad 100644 --- a/tests/test_keyring_storage.py +++ b/tests/contrib/test_keyring_storage.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for oauth2client.keyring_storage tests. - -Unit tests for oauth2client.keyring_storage. -""" +"""Tests for oauth2client.contrib.keyring_storage.""" import datetime import keyring @@ -26,7 +23,7 @@ import mock from oauth2client import GOOGLE_TOKEN_URI from oauth2client.client import OAuth2Credentials -from oauth2client.keyring_storage import Storage +from oauth2client.contrib.keyring_storage import Storage __author__ = 'jcgregorio@google.com (Joe Gregorio)' @@ -67,8 +64,8 @@ class KeyringStorageTests(unittest.TestCase): with mock.patch.object(keyring, 'get_password', return_value=mock_content, autospec=True) as get_password: - with mock.patch( - 'oauth2client.keyring_storage.Credentials') as MockCreds: + class_name = 'oauth2client.contrib.keyring_storage.Credentials' + with mock.patch(class_name) as MockCreds: MockCreds.new_from_json = new_from_json = mock.MagicMock( name='new_from_json', return_value=mock_return_creds) store = Storage(service_name, user_name) diff --git a/tests/test_multistore_file.py b/tests/contrib/test_multistore_file.py similarity index 98% rename from tests/test_multistore_file.py rename to tests/contrib/test_multistore_file.py index c1187c4..84a217f 100644 --- a/tests/test_multistore_file.py +++ b/tests/contrib/test_multistore_file.py @@ -9,8 +9,8 @@ import unittest from oauth2client import util from oauth2client.client import OAuth2Credentials -from oauth2client import locked_file -from oauth2client import multistore_file +from oauth2client.contrib import locked_file +from oauth2client.contrib import multistore_file _filehandle, FILENAME = tempfile.mkstemp('oauth2client_test.data') os.close(_filehandle) diff --git a/tests/test_file.py b/tests/test_file.py index 42f8138..a2d8097 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -239,6 +239,7 @@ class OAuth2ClientFileTests(unittest.TestCase): self.assertNotEquals(None, credentials) self.assertEquals('foo', credentials.access_token) + self.assertTrue(os.path.exists(FILENAME)) if os.name == 'posix': diff --git a/tox.ini b/tox.ini index ef87e79..db459cb 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ deps = {[testenv]basedeps} django setenv = pypy: with_gmp=no - DJANGO_SETTINGS_MODULE=tests.test_django_settings + DJANGO_SETTINGS_MODULE=tests.contrib.test_django_settings commands = nosetests --ignore-files=test_appengine\.py {posargs} [coverbase] @@ -27,18 +27,18 @@ commands = --cover-erase \ --cover-tests \ --cover-branches \ - --ignore-files=test_appengine\.py + --ignore-files=contrib/test_appengine\.py nosetests \ --with-coverage \ - --cover-package=oauth2client.appengine \ - --cover-package=tests.test_appengine \ + --cover-package=oauth2client.contrib.appengine \ + --cover-package=tests.contrib.test_appengine \ --with-gae \ --cover-tests \ --cover-branches \ --gae-application=tests/data \ --gae-lib-root={env:GAE_PYTHONPATH} \ --logging-level=INFO \ - tests/test_appengine.py + tests/contrib/test_appengine.py deps = {[testenv]deps} coverage nosegae @@ -106,7 +106,11 @@ basepython = python2.7 deps = {[testenv]basedeps} nosegae commands = - nosetests --with-gae --gae-application=tests/data --logging-level=INFO tests/test_appengine.py + nosetests \ + --with-gae \ + --gae-application=tests/data \ + --logging-level=INFO \ + tests/contrib/test_appengine.py setenv: PYTHONPATH={env:GAE_PYTHONPATH:}