def test_secretlink_serializer_creation(app, db):
    """Ensure that no two tokens are identical."""
    with app.app_context():
        s = SecretLinkSerializer()
        t1 = s.create_token(98765, dict(recid=4321))
        t2 = s.create_token(98765, dict(recid=4321))
        assert t1 != t2
def test_secretlink_serializer_noencryption(app, db):
    """Test that token is not encrypted."""
    with app.app_context():
        s = SecretLinkSerializer()
        t1 = s.create_token(1, dict(recid=1))
        with pytest.raises(BadSignature):
            JSONWebSignatureSerializer('anotherkey').loads(t1)
Exemplo n.º 3
0
 def test_create_validate(self):
     """Test token creation."""
     s = SecretLinkSerializer()
     t = s.create_token(1234, dict(recid=56789))
     data = s.validate_token(t)
     self.assertEqual(data['id'], 1234)
     self.assertEqual(data['data']['recid'], 56789)
def test_secretlink_serializer_create_validate(app, db):
    """Test token creation."""
    with app.app_context():
        s = SecretLinkSerializer()
        t = s.create_token(1234, dict(recid=56789))
        data = s.validate_token(t)
        assert data['id'] == 1234
        assert data['data']['recid'] == 56789
Exemplo n.º 5
0
 def test_noencryption(self):
     """Test that token is not encrypted."""
     s = SecretLinkSerializer()
     t1 = s.create_token(1, dict(recid=1))
     self.assertRaises(
         BadSignature,
         JSONWebSignatureSerializer('anotherkey').loads,
         t1
     )
Exemplo n.º 6
0
 def test_creation(self):
     """Ensure that no two tokens are identical."""
     s = SecretLinkSerializer()
     t1 = s.create_token(98765, dict(recid=4321))
     t2 = s.create_token(98765, dict(recid=4321))
     self.assertNotEqual(t1, t2)