def email_detail(email): start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': email}) result.update({'username_id': request.query.o}) result.update( user_closed_tickets( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), email)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'summary': get_summary_info()}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) return template('ticket_list', result)
def test_user_closed_tickets_unknown_email(): rt_object = RTApiMock() rt_object.set_return([ u'id: ticket/887677', u'owner: [email protected]', u'subject: create rt dashboard', u'status: open', u'priority: 26', u'cf.{servico}: csc-gsiic', u'cf.{is - informatica e sistemas}: dir-inbox', ]) test_config = DITICConfig() test_config.email_to_user = { '*****@*****.**': 'Vapi', '*****@*****.**': 'Alex', } with pytest.raises(ValueError) as value_error: user_closed_tickets(rt_object, '*****@*****.**') assert 'Unknown email/user:' in str(value_error)
def test_user_closed_tickets_known_email(): rt_object = RTApiMock() rt_object.set_return([ u'id: ticket/887677', u'owner: [email protected]', u'subject: create rt dashboard', u'status: open', u'priority: 26', u'cf.{servico}: csc-gsiic', u'cf.{is - informatica e sistemas}: dir-inbox', u'lastupdated: wed jul 15 21:16:50 2015', ]) result = user_closed_tickets(rt_object, '*****@*****.**') assert result == { 'tickets': { '07/15': [ { u'status': u'open', u'priority': u'26', 'kanban_actions': { 'increase_priority': True, 'decrease_priority': True, 'back': True, 'interrupted': True, 'stalled': True, 'forward': True }, u'lastupdated': u'wed jul 15 21:16:50 2015', 'auxiliary_date': '07/15', u'owner': u'*****@*****.**', u'cf.{is - informatica e sistemas}': u'dir-inbox', 'id': u'887677', u'cf.{servico}': u'csc-gsiic', u'subject': u'create rt dashboard' } ] }, 'email_limit': { 'new': 7, 'open': 1, 'rejected': 7 }, 'number_tickets_per_status': { '*****@*****.**': 1 } }
def test_user_closed_tickets_known_email(): rt_object = RTApiMock() rt_object.set_return([ u'id: ticket/887677', u'owner: [email protected]', u'subject: create rt dashboard', u'status: open', u'priority: 26', u'cf.{servico}: csc-gsiic', u'cf.{is - informatica e sistemas}: dir-inbox', u'lastupdated: wed jul 15 21:16:50 2015', ]) result = user_closed_tickets(rt_object, '*****@*****.**') assert result == { 'tickets': { '07/15': [{ u'status': u'open', u'priority': u'26', 'kanban_actions': { 'increase_priority': True, 'decrease_priority': True, 'back': True, 'interrupted': True, 'stalled': True, 'forward': True }, u'lastupdated': u'wed jul 15 21:16:50 2015', 'auxiliary_date': '07/15', u'owner': u'*****@*****.**', u'cf.{is - informatica e sistemas}': u'dir-inbox', 'id': u'887677', u'cf.{servico}': u'csc-gsiic', u'subject': u'create rt dashboard' }] }, 'email_limit': { 'new': 7, 'open': 1, 'rejected': 7 }, 'number_tickets_per_status': { '*****@*****.**': 1 } }
def email_detail(email): start_time = time() result = create_default_result() if request.query.o == "" or not user_auth.check_id(request.query.o): result.update({"message": ""}) return template("auth", result) result.update({"username": user_auth.get_email_from_id(request.query.o)}) result.update({"email": email}) result.update({"username_id": request.query.o}) result.update( user_closed_tickets(user_auth.get_rt_object_from_email(user_auth.get_email_from_id(request.query.o)), email) ) # Is there any URGENT ticket? result.update({"urgent": get_urgent_tickets(rt_object)}) result.update({"time_spent": "%0.2f seconds" % (time() - start_time)}) return template("ticket_list", result)
def email_detail(email): start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': email}) result.update({'username_id': request.query.o}) result.update(user_closed_tickets( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), email)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'summary:': get_summary_info()}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) return template('ticket_list', result)