[mq]: smallfixes
diff --git a/tests/test_discovery.py b/tests/test_discovery.py
index 5970970..91db712 100644
--- a/tests/test_discovery.py
+++ b/tests/test_discovery.py
@@ -193,6 +193,16 @@
self.assertEqual(q['trace'], ['html'])
self.assertEqual(q['fields'], ['description'])
+ def test_string_params_none_is_invalid(self):
+ http = HttpMock(datafile('zoo.json'), {'status': '200'})
+ zoo = build('zoo', 'v1', http)
+ # String isn't None
+ try:
+ request = zoo.query(trace=None, fields='description')
+ self.fail()
+ except ValueError, e:
+ self.assertTrue('None' in str(e))
+
def test_model_added_query_parameters(self):
http = HttpMock(datafile('zoo.json'), {'status': '200'})
zoo = build('zoo', 'v1', http)
diff --git a/tests/test_oauth2client.py b/tests/test_oauth2client.py
index cb1b4b3..eb2d7db 100644
--- a/tests/test_oauth2client.py
+++ b/tests/test_oauth2client.py
@@ -279,6 +279,19 @@
credentials = self.flow.step2_exchange('some random code', http)
self.assertEqual(None, credentials.token_expiry)
+ def test_exchange_fails_if_no_code(self):
+ http = HttpMockSequence([
+ ({'status': '200'}, """{ "access_token":"SlAV32hkKG",
+ "refresh_token":"8xLOxBtZp8" }"""),
+ ])
+
+ code = {'error': 'thou shall not pass'}
+ try:
+ credentials = self.flow.step2_exchange(code, http)
+ self.fail('should raise exception if no code in dictionary.')
+ except FlowExchangeError, e:
+ self.assertTrue('shall not pass' in str(e))
+
def test_exchange_id_token_fail(self):
http = HttpMockSequence([
({'status': '200'}, """{ "access_token":"SlAV32hkKG",