Skip to content

Commit

Permalink
Run tests for both clients with and without a secret
Browse files Browse the repository at this point in the history
  • Loading branch information
armicron committed Sep 26, 2017
1 parent fddf4fc commit 268e163
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
language: python
env:
- USE_CLIENT_SECRET=True
- USE_CLIENT_SECRET=False
python:
- "2.7"
- "3.6"
Expand Down
27 changes: 20 additions & 7 deletions warrant/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
class UserObjTestCase(unittest.TestCase):

def setUp(self):
if env('USE_CLIENT_SECRET') == 'True':
self.app_id = env('COGNITO_APP_WITH_SECRET_ID')
else:
self.app_id = env('COGNITO_APP_ID')
self.cognito_user_pool_id = env('COGNITO_USER_POOL_ID')
self.app_id = env('COGNITO_APP_ID')
self.username = env('COGNITO_TEST_USERNAME')

self.user = Cognito(self.cognito_user_pool_id, self.app_id,
Expand All @@ -36,8 +39,11 @@ def test_init(self):
class GroupObjTestCase(unittest.TestCase):

def setUp(self):
if env('USE_CLIENT_SECRET') == 'True':
self.app_id = env('COGNITO_APP_WITH_SECRET_ID')
else:
self.app_id = env('COGNITO_APP_ID')
self.cognito_user_pool_id = env('COGNITO_USER_POOL_ID')
self.app_id = env('COGNITO_APP_ID')
self.group_data = {'GroupName': 'test_group', 'Precedence': 1}
self.cognito_obj = Cognito(self.cognito_user_pool_id, self.app_id)

Expand All @@ -50,9 +56,13 @@ def test_init(self):
class CognitoAuthTestCase(unittest.TestCase):

def setUp(self):
if env('USE_CLIENT_SECRET') == 'True':
self.app_id = env('COGNITO_APP_WITH_SECRET_ID')
self.client_secret = env('COGNITO_CLIENT_SECRET')
else:
self.app_id = env('COGNITO_APP_ID')
self.client_secret = None
self.cognito_user_pool_id = env('COGNITO_USER_POOL_ID')
self.app_id = env('COGNITO_APP_ID')
self.client_secret = env('COGNITO_CLIENT_SECRET')
self.username = env('COGNITO_TEST_USERNAME')
self.password = env('COGNITO_TEST_PASSWORD')
self.user = Cognito(self.cognito_user_pool_id,self.app_id,
Expand Down Expand Up @@ -162,12 +172,15 @@ def test_admin_authenticate(self):
class AWSSRPTestCase(unittest.TestCase):

def setUp(self):
if env('USE_CLIENT_SECRET') == 'True':
self.client_secret = env('COGNITO_CLIENT_SECRET')
self.app_id = env('COGNITO_APP_WITH_SECRET_ID')
else:
self.app_id = env('COGNITO_APP_ID')
self.client_secret = None
self.cognito_user_pool_id = env('COGNITO_USER_POOL_ID')
self.app_id = env('COGNITO_APP_ID')
self.client_secret = env('COGNITO_CLIENT_SECRET')
self.username = env('COGNITO_TEST_USERNAME')
self.password = env('COGNITO_TEST_PASSWORD')

self.aws = AWSSRP(username=self.username, password=self.password,
pool_id=self.cognito_user_pool_id,
client_id=self.app_id, client_secret=self.client_secret)
Expand Down

0 comments on commit 268e163

Please sign in to comment.