Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for bespin.amazon.credentials #44

Merged
merged 3 commits into from Apr 22, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions tests/amazon/test_credentials.py
Expand Up @@ -21,7 +21,7 @@
self.assertEquals(credentials.account_id, 123456789012)
self.assertEquals(credentials.region, 'us-west-1')
self.assertTrue(credentials._verified)
self.assertIsNotNone(credentials.session)
self.assertNotEqual(credentials.session, None)
self.assertEquals(credentials.session.region_name, 'us-west-1')

aws_creds = credentials.session.get_credentials()
Expand All @@ -33,8 +33,7 @@
@mock_sts
it "verify_creds ensures account_id matches aws":
credentials = Credentials('us-west-1', 987654321, NotSpecified)
with self.assertRaises(BespinError):
credentials.verify_creds() # 987654321 != 123456789012
self.assertRaises(BespinError, credentials.verify_creds) # 987654321 != 123456789012
Copy link
Owner

@delfick delfick Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest

with self.fuzzAssertRaisesError(BespinError, "message you expect", kwarg1=1, kwarg2=2):
    credentials.verify_creds()

It's defined by delfick_error (https://github.com/delfick/delfick_error/blob/master/delfick_error.py#L143)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis didn't like that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see delfick_error in setup.py

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's pulled in by delfick-app


@mock_sts
it "assumes provided role":
Expand All @@ -45,7 +44,7 @@
self.fail("verify_creds() raised Exception unexpectedly!")
self.assertTrue(credentials._verified)

self.assertIsNotNone(credentials.session)
self.assertNotEqual(credentials.session, None)
self.assertTrue('AWS_ACCESS_KEY_ID' in os.environ)
self.assertTrue('AWS_SECRET_ACCESS_KEY' in os.environ)
self.assertTrue('AWS_SECURITY_TOKEN' in os.environ)
Expand Down