Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Drop unittest2 dependency #610

Merged
merged 1 commit into from
Aug 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/run_gce_system_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
# limitations under the License.

import json
import unittest

from six.moves import http_client
from six.moves import urllib
import unittest2

import oauth2client
from oauth2client import client
from oauth2client import transport
from oauth2client.contrib import gce


class TestComputeEngine(unittest2.TestCase):
class TestComputeEngine(unittest.TestCase):

def test_application_default(self):
default_creds = client.GoogleCredentials.get_application_default()
Expand Down Expand Up @@ -53,4 +53,4 @@ def test_token_info(self):


if __name__ == '__main__':
unittest2.main()
unittest.main()
6 changes: 3 additions & 3 deletions tests/contrib/appengine/test__appengine_ndb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

import json
import os
import unittest

from google.appengine.ext import ndb
from google.appengine.ext import testbed
import mock
import unittest2

from oauth2client import client
from oauth2client.contrib import appengine
Expand All @@ -36,7 +36,7 @@ class TestNDBModel(ndb.Model):
creds = appengine.CredentialsNDBProperty()


class TestFlowNDBProperty(unittest2.TestCase):
class TestFlowNDBProperty(unittest.TestCase):

def setUp(self):
self.testbed = testbed.Testbed()
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_validate_bad_type(self, mock_logger):
type(flow_val))


class TestCredentialsNDBProperty(unittest2.TestCase):
class TestCredentialsNDBProperty(unittest.TestCase):

def setUp(self):
self.testbed = testbed.Testbed()
Expand Down
16 changes: 8 additions & 8 deletions tests/contrib/appengine/test_appengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import os
import tempfile
import time
import unittest

from google.appengine.api import apiproxy_stub
from google.appengine.api import apiproxy_stub_map
Expand All @@ -30,7 +31,6 @@
import mock
from six.moves import urllib
from six.moves import urllib_parse
import unittest2
import webapp2
from webtest import TestApp

Expand Down Expand Up @@ -81,7 +81,7 @@ def __call__(self):
return None


class TestAppAssertionCredentials(unittest2.TestCase):
class TestAppAssertionCredentials(unittest.TestCase):
account_name = "service_account_name@appspot.com"
signature = "signature"

Expand Down Expand Up @@ -266,7 +266,7 @@ class TestFlowModel(db.Model):
flow = appengine.FlowProperty()


class FlowPropertyTest(unittest2.TestCase):
class FlowPropertyTest(unittest.TestCase):

def setUp(self):
self.testbed = testbed.Testbed()
Expand Down Expand Up @@ -305,7 +305,7 @@ class TestCredentialsModel(db.Model):
credentials = appengine.CredentialsProperty()


class CredentialsPropertyTest(unittest2.TestCase):
class CredentialsPropertyTest(unittest.TestCase):

def setUp(self):
self.testbed = testbed.Testbed()
Expand Down Expand Up @@ -359,7 +359,7 @@ def test_validate(self):
appengine.CredentialsProperty().validate(42)


class StorageByKeyNameTest(unittest2.TestCase):
class StorageByKeyNameTest(unittest.TestCase):

def setUp(self):
self.testbed = testbed.Testbed()
Expand Down Expand Up @@ -596,7 +596,7 @@ class MockRequestHandler(object):
request = MockRequest()


class DecoratorTests(unittest2.TestCase):
class DecoratorTests(unittest.TestCase):

def setUp(self):
self.testbed = testbed.Testbed()
Expand Down Expand Up @@ -1051,7 +1051,7 @@ def test_invalid_state(self, new_http):
new_http.assert_called_once_with()


class DecoratorXsrfSecretTests(unittest2.TestCase):
class DecoratorXsrfSecretTests(unittest.TestCase):
"""Test xsrf_secret_key."""

def setUp(self):
Expand Down Expand Up @@ -1100,7 +1100,7 @@ def test_db_insert_ndb_get(self):
self.assertEqual(site_key.secret, secret)


class DecoratorXsrfProtectionTests(unittest2.TestCase):
class DecoratorXsrfProtectionTests(unittest.TestCase):
"""Test _build_state_value and _parse_state_value."""

def setUp(self):
Expand Down
5 changes: 2 additions & 3 deletions tests/contrib/django_util/test_django_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@

import base64
import pickle
import unittest

from tests.contrib.django_util.models import CredentialsModel

import unittest2

from oauth2client import _helpers
from oauth2client.client import Credentials
from oauth2client.contrib.django_util.models import CredentialsField


class TestCredentialsField(unittest2.TestCase):
class TestCredentialsField(unittest.TestCase):

def setUp(self):
self.fake_model = CredentialsModel()
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/django_util/test_django_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

# Mock a Django environment
import datetime
import unittest

from django.db import models
import mock
import unittest2

from oauth2client import GOOGLE_TOKEN_URI
from oauth2client.client import OAuth2Credentials
Expand All @@ -28,7 +28,7 @@
DjangoORMStorage as Storage)


class TestStorage(unittest2.TestCase):
class TestStorage(unittest.TestCase):
def setUp(self):
access_token = 'foo'
client_id = 'some_client_id'
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/django_util/test_django_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""Tests the initialization logic of django_util."""

import copy
import unittest

import django.conf
from django.conf.urls import include, url
Expand All @@ -23,7 +24,6 @@
import mock
from six.moves import reload_module
from tests.contrib.django_util import TestWithDjangoEnvironment
import unittest2

from oauth2client.contrib import django_util
import oauth2client.contrib.django_util
Expand All @@ -36,7 +36,7 @@
]


class OAuth2SetupTest(unittest2.TestCase):
class OAuth2SetupTest(unittest.TestCase):

def setUp(self):
self.save_settings = copy.deepcopy(django.conf.settings)
Expand Down
8 changes: 4 additions & 4 deletions tests/contrib/test_devshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import os
import socket
import threading
import unittest

import mock
import unittest2

from oauth2client import _helpers
from oauth2client import client
Expand All @@ -38,7 +38,7 @@
])


class TestCredentialInfoResponse(unittest2.TestCase):
class TestCredentialInfoResponse(unittest.TestCase):

def test_constructor_with_non_list(self):
json_non_list = '{}'
Expand Down Expand Up @@ -71,7 +71,7 @@ def test_constructor_full_list(self):
self.assertEqual(info_response.expires_in, expires_in)


class Test_SendRecv(unittest2.TestCase):
class Test_SendRecv(unittest.TestCase):

def test_port_zero(self):
with mock.patch('oauth2client.contrib.devshell.os') as os_mod:
Expand Down Expand Up @@ -168,7 +168,7 @@ def run(self):
s.close()


class DevshellCredentialsTests(unittest2.TestCase):
class DevshellCredentialsTests(unittest.TestCase):

def test_signals_no_server(self):
with self.assertRaises(devshell.NoDevshellServer):
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/test_dictionary_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

"""Unit tests for oauth2client.contrib.dictionary_storage"""

import unittest2
import unittest

import oauth2client
from oauth2client import client
Expand All @@ -37,7 +37,7 @@ def _generate_credentials(scopes=None):
scopes=scopes)


class DictionaryStorageTests(unittest2.TestCase):
class DictionaryStorageTests(unittest.TestCase):

def test_constructor_defaults(self):
dictionary = {}
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/test_flask_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import datetime
import json
import logging
import unittest

import flask
import mock
import six.moves.http_client as httplib
import six.moves.urllib.parse as urlparse
import unittest2

import oauth2client
from oauth2client import client
Expand All @@ -44,7 +44,7 @@
"""


class FlaskOAuth2Tests(unittest2.TestCase):
class FlaskOAuth2Tests(unittest.TestCase):

def setUp(self):
self.app = flask.Flask(__name__)
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/test_gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

import datetime
import json
import unittest

import mock
from six.moves import http_client
import unittest2

from oauth2client import client
from oauth2client.contrib import _metadata
Expand All @@ -35,7 +35,7 @@
METADATA_PATH = 'instance/service-accounts/a@example.com/token'


class AppAssertionCredentialsTests(unittest2.TestCase):
class AppAssertionCredentialsTests(unittest.TestCase):

def test_constructor(self):
credentials = gce.AppAssertionCredentials()
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/test_keyring_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

import datetime
import threading
import unittest

import keyring
import mock
import unittest2

import oauth2client
from oauth2client import client
Expand All @@ -29,7 +29,7 @@
__author__ = 'jcgregorio@google.com (Joe Gregorio)'


class KeyringStorageTests(unittest2.TestCase):
class KeyringStorageTests(unittest.TestCase):

def test_constructor(self):
service_name = 'my_unit_test'
Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

import datetime
import json
import unittest

import mock
from six.moves import http_client
import unittest2

from oauth2client.contrib import _metadata
from .. import http_mock
Expand All @@ -37,7 +37,7 @@ def request_mock(status, content_type, content):
return http


class TestMetadata(unittest2.TestCase):
class TestMetadata(unittest.TestCase):

def test_get_success_json(self):
http = request_mock(
Expand Down
8 changes: 4 additions & 4 deletions tests/contrib/test_multiprocess_file_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import multiprocessing
import os
import tempfile
import unittest

import fasteners
import mock
from six import StringIO
import unittest2

from oauth2client import client
from oauth2client.contrib import multiprocess_file_storage
Expand Down Expand Up @@ -75,7 +75,7 @@ def _generate_token_response_http(new_token='new_token'):
return http


class MultiprocessStorageBehaviorTests(unittest2.TestCase):
class MultiprocessStorageBehaviorTests(unittest.TestCase):

def setUp(self):
filehandle, self.filename = tempfile.mkstemp(
Expand Down Expand Up @@ -200,7 +200,7 @@ def child_process(die_event, ready_event): # pragma: NO COVER
self.assertIsNotNone(store.get())


class MultiprocessStorageUnitTests(unittest2.TestCase):
class MultiprocessStorageUnitTests(unittest.TestCase):

def setUp(self):
filehandle, self.filename = tempfile.mkstemp(
Expand Down Expand Up @@ -310,4 +310,4 @@ def test__refresh_predicate(self):


if __name__ == '__main__': # pragma: NO COVER
unittest2.main()
unittest.main()
Loading