aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_tests/tests/unit/_auth_test.py
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2017-01-17 15:00:34 -0800
committerGravatar GitHub <noreply@github.com>2017-01-17 15:00:34 -0800
commitfc4b07e10c0482522dbc6a01401ea8f1606a76b4 (patch)
tree622b321c1682d85950c8b9519c2f957b26e6e52e /src/python/grpcio_tests/tests/unit/_auth_test.py
parentc0d7d67dfbe4f7d539e64365c4111b748285668f (diff)
parentcc793703bfba6f661f523b6fec82ff8a913e1759 (diff)
Merge pull request #9276 from soltanmm-google/remember-the-blue-flowers-they-are-important!
Enable yapf (Python formatting).
Diffstat (limited to 'src/python/grpcio_tests/tests/unit/_auth_test.py')
-rw-r--r--src/python/grpcio_tests/tests/unit/_auth_test.py69
1 files changed, 34 insertions, 35 deletions
diff --git a/src/python/grpcio_tests/tests/unit/_auth_test.py b/src/python/grpcio_tests/tests/unit/_auth_test.py
index c31f7b06f7..52bd1cb7ba 100644
--- a/src/python/grpcio_tests/tests/unit/_auth_test.py
+++ b/src/python/grpcio_tests/tests/unit/_auth_test.py
@@ -26,7 +26,6 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
"""Tests of standard AuthMetadataPlugins."""
import collections
@@ -38,59 +37,59 @@ from grpc import _auth
class MockGoogleCreds(object):
- def get_access_token(self):
- token = collections.namedtuple('MockAccessTokenInfo',
- ('access_token', 'expires_in'))
- token.access_token = 'token'
- return token
+ def get_access_token(self):
+ token = collections.namedtuple('MockAccessTokenInfo',
+ ('access_token', 'expires_in'))
+ token.access_token = 'token'
+ return token
class MockExceptionGoogleCreds(object):
- def get_access_token(self):
- raise Exception()
+ def get_access_token(self):
+ raise Exception()
class GoogleCallCredentialsTest(unittest.TestCase):
- def test_google_call_credentials_success(self):
- callback_event = threading.Event()
+ def test_google_call_credentials_success(self):
+ callback_event = threading.Event()
- def mock_callback(metadata, error):
- self.assertEqual(metadata, (('authorization', 'Bearer token'),))
- self.assertIsNone(error)
- callback_event.set()
+ def mock_callback(metadata, error):
+ self.assertEqual(metadata, (('authorization', 'Bearer token'),))
+ self.assertIsNone(error)
+ callback_event.set()
- call_creds = _auth.GoogleCallCredentials(MockGoogleCreds())
- call_creds(None, mock_callback)
- self.assertTrue(callback_event.wait(1.0))
+ call_creds = _auth.GoogleCallCredentials(MockGoogleCreds())
+ call_creds(None, mock_callback)
+ self.assertTrue(callback_event.wait(1.0))
- def test_google_call_credentials_error(self):
- callback_event = threading.Event()
+ def test_google_call_credentials_error(self):
+ callback_event = threading.Event()
- def mock_callback(metadata, error):
- self.assertIsNotNone(error)
- callback_event.set()
+ def mock_callback(metadata, error):
+ self.assertIsNotNone(error)
+ callback_event.set()
- call_creds = _auth.GoogleCallCredentials(MockExceptionGoogleCreds())
- call_creds(None, mock_callback)
- self.assertTrue(callback_event.wait(1.0))
+ call_creds = _auth.GoogleCallCredentials(MockExceptionGoogleCreds())
+ call_creds(None, mock_callback)
+ self.assertTrue(callback_event.wait(1.0))
class AccessTokenCallCredentialsTest(unittest.TestCase):
- def test_google_call_credentials_success(self):
- callback_event = threading.Event()
+ def test_google_call_credentials_success(self):
+ callback_event = threading.Event()
- def mock_callback(metadata, error):
- self.assertEqual(metadata, (('authorization', 'Bearer token'),))
- self.assertIsNone(error)
- callback_event.set()
+ def mock_callback(metadata, error):
+ self.assertEqual(metadata, (('authorization', 'Bearer token'),))
+ self.assertIsNone(error)
+ callback_event.set()
- call_creds = _auth.AccessTokenCallCredentials('token')
- call_creds(None, mock_callback)
- self.assertTrue(callback_event.wait(1.0))
+ call_creds = _auth.AccessTokenCallCredentials('token')
+ call_creds(None, mock_callback)
+ self.assertTrue(callback_event.wait(1.0))
if __name__ == '__main__':
- unittest.main(verbosity=2)
+ unittest.main(verbosity=2)