| OLD | NEW |
| 1 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ |
| 2 # All rights reserved. | 2 # All rights reserved. |
| 3 # | 3 # |
| 4 # Permission is hereby granted, free of charge, to any person obtaining a | 4 # Permission is hereby granted, free of charge, to any person obtaining a |
| 5 # copy of this software and associated documentation files (the | 5 # copy of this software and associated documentation files (the |
| 6 # "Software"), to deal in the Software without restriction, including | 6 # "Software"), to deal in the Software without restriction, including |
| 7 # without limitation the rights to use, copy, modify, merge, publish, dis- | 7 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 8 # tribute, sublicense, and/or sell copies of the Software, and to permit | 8 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 9 # persons to whom the Software is furnished to do so, subject to the fol- | 9 # persons to whom the Software is furnished to do so, subject to the fol- |
| 10 # lowing conditions: | 10 # lowing conditions: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 import unittest | 27 import unittest |
| 28 import time | 28 import time |
| 29 import os | 29 import os |
| 30 from boto.exception import BotoServerError | 30 from boto.exception import BotoServerError |
| 31 from boto.sts.connection import STSConnection | 31 from boto.sts.connection import STSConnection |
| 32 from boto.sts.credentials import Credentials | 32 from boto.sts.credentials import Credentials |
| 33 from boto.s3.connection import S3Connection | 33 from boto.s3.connection import S3Connection |
| 34 | 34 |
| 35 | 35 |
| 36 class SessionTokenTest (unittest.TestCase): | 36 class SessionTokenTest(unittest.TestCase): |
| 37 sts = True | 37 sts = True |
| 38 | 38 |
| 39 def test_session_token(self): | 39 def test_session_token(self): |
| 40 print '--- running Session Token tests ---' | 40 print '--- running Session Token tests ---' |
| 41 c = STSConnection() | 41 c = STSConnection() |
| 42 | 42 |
| 43 # Create a session token | 43 # Create a session token |
| 44 token = c.get_session_token() | 44 token = c.get_session_token() |
| 45 | 45 |
| 46 # Save session token to a file | 46 # Save session token to a file |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 self.assertTrue('Not authorized' in err.body) | 83 self.assertTrue('Not authorized' in err.body) |
| 84 | 84 |
| 85 def test_decode_authorization_message(self): | 85 def test_decode_authorization_message(self): |
| 86 c = STSConnection() | 86 c = STSConnection() |
| 87 | 87 |
| 88 try: | 88 try: |
| 89 creds = c.decode_authorization_message('b94d27b9934') | 89 creds = c.decode_authorization_message('b94d27b9934') |
| 90 except BotoServerError as err: | 90 except BotoServerError as err: |
| 91 self.assertEqual(err.status, 400) | 91 self.assertEqual(err.status, 400) |
| 92 self.assertTrue('Invalid token' in err.body) | 92 self.assertTrue('Invalid token' in err.body) |
| OLD | NEW |