def test_constructor_full_list(self): user_email = 'user_email' project_id = 'project_id' access_token = 'access_token' expires_in = 1 json_string = json.dumps( [user_email, project_id, access_token, expires_in]) info_response = devshell.CredentialInfoResponse(json_string) self.assertEqual(info_response.user_email, user_email) self.assertEqual(info_response.project_id, project_id) self.assertEqual(info_response.access_token, access_token) self.assertEqual(info_response.expires_in, expires_in)
def test_constructor_empty_list(self): info_response = devshell.CredentialInfoResponse('[]') self.assertEqual(info_response.user_email, None) self.assertEqual(info_response.project_id, None) self.assertEqual(info_response.access_token, None) self.assertEqual(info_response.expires_in, None)
def test_constructor_with_bad_json(self): json_non_list = '{BADJSON' with self.assertRaises(ValueError): devshell.CredentialInfoResponse(json_non_list)