31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
|
|
from app_new.extensions import db
|
||
|
|
from app_new.outlook.models import GmaoContext
|
||
|
|
|
||
|
|
|
||
|
|
def test_gmao_config_accepts_one_year_lookback(authenticated_client, app, admin_user):
|
||
|
|
response = authenticated_client.post('/gmao-config/save', data={
|
||
|
|
'auto_interpret_lookback_hours': '8760',
|
||
|
|
'outlook_sync_lookback_hours': '8760',
|
||
|
|
})
|
||
|
|
assert response.status_code == 302
|
||
|
|
with app.app_context():
|
||
|
|
context = GmaoContext.query.filter_by(user_id=admin_user['id']).one()
|
||
|
|
assert context.auto_interpret_lookback_hours == 8760
|
||
|
|
assert context.outlook_sync_lookback_hours == 8760
|
||
|
|
db.session.delete(context)
|
||
|
|
db.session.commit()
|
||
|
|
|
||
|
|
|
||
|
|
def test_gmao_config_caps_lookback_at_one_year(authenticated_client, app, admin_user):
|
||
|
|
response = authenticated_client.post('/gmao-config/save', data={
|
||
|
|
'auto_interpret_lookback_hours': '9000',
|
||
|
|
'outlook_sync_lookback_hours': '9000',
|
||
|
|
})
|
||
|
|
assert response.status_code == 302
|
||
|
|
with app.app_context():
|
||
|
|
context = GmaoContext.query.filter_by(user_id=admin_user['id']).one()
|
||
|
|
assert context.auto_interpret_lookback_hours == 8760
|
||
|
|
assert context.outlook_sync_lookback_hours == 8760
|
||
|
|
db.session.delete(context)
|
||
|
|
db.session.commit()
|