def test_expired_token(client): token = Token() token.save() time.sleep(config.get('AUTH_DATETIME_PADDING') + 1) # Try with querystring response = client.get( url_for('mobile_bp.index', token=token.token, _external=False)) assert response.status_code == 403 token.delete_instance()
def test_valid_already_taken_token(client): token = Token() token.used = True token.save() response = client.get( url_for('mobile_bp.index', token=token.token, _external=False)) assert response.status_code == 403 token.delete_instance()
def test_valid_token_busy_line(client): token = Token() token.save() dummy_caller_id = '123456789' call = Call() call.get_the_line(dummy_caller_id) response = client.get( url_for('mobile_bp.index', token=token.token, _external=False)) assert response.status_code == 423 call.delete_instance() token.delete_instance()
def test_valid_token(client): token = Token() token.save() # Try with querystring response = client.get( url_for('mobile_bp.index', token=token.token, _external=False)) assert response.status_code == 200 # Then session response = client.get(url_for('mobile_bp.index', _external=False)) assert response.status_code == 200 token.refresh_from_db() assert token.used is True token.delete_instance() call = Call.get_call() assert call.status == Call.ON_CALL call.delete_instance()