aboutsummaryrefslogtreecommitdiff
path: root/tests/test_tools.py
diff options
context:
space:
mode:
authorPat Ferate <pferate@users.noreply.github.com>2016-07-06 12:45:49 -0700
committerJon Wayne Parrott <jonwayne@google.com>2016-07-06 12:45:49 -0700
commitf25b7abfafb8610b8434b023cc0a77eb8f4c0b67 (patch)
tree69ad92ae6aeabe0f09c45401035cb4f80cf0b68a /tests/test_tools.py
parent267bbc59caad625b3905eec29c040f61aab3b4f0 (diff)
downloadoauth2client-f25b7abfafb8610b8434b023cc0a77eb8f4c0b67.tar.gz
Use context manager for assertRaises (#537)
* Use context manager for assertRaises, fixes #536. * Update usage of unittest to unittest2. * Remove unneeded `if __name__ == '__main__':` clauses in test files.
Diffstat (limited to 'tests/test_tools.py')
-rw-r--r--tests/test_tools.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/test_tools.py b/tests/test_tools.py
index b5e07db..8efe9e1 100644
--- a/tests/test_tools.py
+++ b/tests/test_tools.py
@@ -102,7 +102,7 @@ class TestRunFlow(unittest2.TestCase):
self.assertEqual(self.flow.redirect_uri, OOB_CALLBACK_URN)
self.flow.step2_exchange.assert_called_once_with(
'auth_code', http=None)
-
+
@mock.patch('oauth2client.tools.logging')
@mock.patch('oauth2client.tools.input')
def test_run_flow_no_webserver_exchange_error(
@@ -161,7 +161,7 @@ class TestRunFlow(unittest2.TestCase):
self, webbrowser_open_mock, server_ctor_mock, logging_mock):
server_ctor_mock.return_value = self.server
self.server.query_params = {}
-
+
# No code found in response
with self.assertRaises(SystemExit):
returned_credentials = tools.run_flow(
@@ -193,7 +193,3 @@ class TestRunFlow(unittest2.TestCase):
class TestMessageIfMissing(unittest2.TestCase):
def test_message_if_missing(self):
self.assertIn('somefile.txt', tools.message_if_missing('somefile.txt'))
-
-
-if __name__ == '__main__': # pragma: NO COVER
- unittest.main()