Beispiel #1
0
def test_reject_expired_token():
    issue_time = make_issue_time(-301)
    tok = make_token(MockConsumer, 'alice', issue_time)
    assert not auth.verify_token(MockConsumer, tok, 'bob', issue_time), "token had expired, should have been rejected"
Beispiel #2
0
def test_reject_inauthentic_token():
    issue_time = make_issue_time()
    tok = make_token(MockConsumer, 'alice', issue_time)
    assert not auth.verify_token(MockConsumer, tok, 'bob', issue_time), "token was inauthentic, should have been rejected"
Beispiel #3
0
def test_reject_invalid_token():
    issue_time = make_issue_time(300)
    tok = make_token(MockConsumer, 'alice', issue_time)
    assert not auth.verify_token(MockConsumer, tok, 'alice', issue_time), "token not yet valid, should have been rejected"
Beispiel #4
0
 def test_reject_expired_token(self):
     expiryTime = iso8601(datetime.datetime.now() - datetime.timedelta(seconds=301))
     tok = make_token('testAccount', 'alice', expiryTime)
     assert not auth.verify_token(tok, 'testAccount', 'bob', expiryTime), "token had expired, should have been rejected"
Beispiel #5
0
def test_verify_token():
    issue_time = make_issue_time()
    tok = make_token(MockConsumer, 'alice', issue_time)
    assert auth.verify_token(MockConsumer, tok, 'alice', issue_time), "token should have been verified"
Beispiel #6
0
 def test_reject_inauthentic_token(self):
     expiryTime = iso8601('future')
     tok = make_token('testAccount', 'alice', expiryTime)
     assert not auth.verify_token(tok, 'testAccount', 'bob', expiryTime), "token was inauthentic, should have been rejected"
Beispiel #7
0
 def test_verify_token(self):
     expiryTime = iso8601('future')
     tok = make_token('testAccount', 'alice', expiryTime)
     assert auth.verify_token(tok, 'testAccount', 'alice', expiryTime), "token should have been verified"
 def test_reject_inauthentic_token(self):
     issueTime = iso8601('now')
     tok = make_token('testConsumer', 'alice', issueTime)
     assert not auth.verify_token(tok, 'testConsumer', 'bob', issueTime), "token was inauthentic, should have been rejected"
 def test_verify_token(self):
     issueTime = iso8601('now')
     tok = make_token('testConsumer', 'alice', issueTime)
     assert auth.verify_token(tok, 'testConsumer', 'alice', issueTime), "token should have been verified"
Beispiel #10
0
 def test_verify_token(self):
     issue_time = make_issue_time()
     tok = make_token('Consumer', 'alice', issue_time)
     assert auth.verify_token(tok, 'Consumer', 'alice', issue_time), "token should have been verified"