Esempio n. 1
0
 def test_set(self, get_mock_db):
     mock_db = get_mock_db()
     database.set('guitar', 'Eastwood-Airline', '$799')
     mock_db.set.assert_called_once_with('guitar:Eastwood-Airline', '$799')
     database.set('guitar', 'Stratocaster', '$1,449', expiration=81)
     mock_db.setex.assert_called_once_with('guitar:Stratocaster', 81,
                                           '$1,449')
Esempio n. 2
0
def authorize():
    r = get_reddit_oauth_session()
    scope = ['identity', 'history', 'vote']
    state = str(uuid4())
    url = r.get_authorize_url(state, scope, True)
    database.set('authentication_state', state, 1,
                     expiration=app.config['REDDIT_AUTH_EXPIRE'])
    return url
Esempio n. 3
0
def set_remember_token(user):
    """Create and save a new remember token for an authentiated user.

    Session tokens are created using the username encrypted with the
    app's secret key via HMAC.
    """
    token = make_secure_token(user.id)
    user.remember_token = token
    database.set('remember_token', token, user.id)
Esempio n. 4
0
def set_remember_token(user):
    """Create and save a new remember token for an authentiated user.

    Session tokens are created using the username encrypted with the
    app's secret key via HMAC.
    """
    token = make_secure_token(user.id)
    user.remember_token = token
    database.set('remember_token', token, user.id)
Esempio n. 5
0
def authorize():
    r = get_reddit_oauth_session()
    scope = ['identity', 'history', 'vote']
    state = str(uuid4())
    url = r.get_authorize_url(state, scope, True)
    database.set('authentication_state',
                 state,
                 1,
                 expiration=app.config['REDDIT_AUTH_EXPIRE'])
    return url
Esempio n. 6
0
 def test_set(self, get_mock_db):
     mock_db = get_mock_db()
     database.set('guitar', 'Eastwood-Airline', '$799')
     mock_db.set.assert_called_once_with('guitar:Eastwood-Airline', '$799')
     database.set('guitar', 'Stratocaster', '$1,449', expiration=81)
     mock_db.setex.assert_called_once_with('guitar:Stratocaster', 81, '$1,449')