Skip to content

Commit

Permalink
Added new test cases to test_main_run
Browse files Browse the repository at this point in the history
  • Loading branch information
Froilan Irizarry committed May 18, 2017
2 parents f6612a7 + f96a98a commit c326ef3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,22 @@ def test_decode_payload_raises_decoded_error(self):

assert 'There was an error decoding the token' in str(excinfo.value)

@pytest.mark.parametrize('key,name,job', [
('1234', 'Vader', 'Sith'),
('4567', 'Anakin', 'Jedi'),
@pytest.mark.parametrize('key,name,job,exp,verify', [
('1234', 'Vader', 'Sith', None, None),
('4567', 'Anakin', 'Jedi', '+1', None),
('4321', 'Padme', 'Queen', '4070926800', 'true'),
])
def test_main_run(self, key, name, job):
def test_main_run(self, key, name, job, exp, verify):
args = [
'--key', key,
'encode',
'name={0}'.format(name),
'job={0}'.format(job)
'job={0}'.format(job),
]
if exp:
args.append('exp={0}'.format(exp))
if verify:
args.append('verify={0}'.format(verify))

token = main(args)
actual = jwt.decode(token, key)
Expand All @@ -57,4 +62,5 @@ def test_main_run(self, key, name, job):
'name': name,
}

assert actual == expected
assert actual['name'] == expected['name']
assert actual['job'] == expected['job']

0 comments on commit c326ef3

Please sign in to comment.