Ejemplo n.º 1
0
def test_users_list():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '*****@*****.**': 'Vapi',
        '*****@*****.**': 'Alex',
    }
    response = test_config.get_users_list()
    assert response == ['Vapi', 'Alex']
Ejemplo n.º 2
0
def test_get_email_from_user():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '*****@*****.**': 'Vapi',
        '*****@*****.**': 'Alex',
    }
    response = test_config.get_email_from_user('Vapi')
    assert response == '*****@*****.**'
Ejemplo n.º 3
0
def test_check_if_email_exist_known_email():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '*****@*****.**': 'Vapi',
        '*****@*****.**': 'Alex',
    }
    response = test_config.check_if_email_exist('*****@*****.**')
    assert response == False
Ejemplo n.º 4
0
def test_check_if_user_exist_unknown_user():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '*****@*****.**': 'Vapi',
        '*****@*****.**': 'Alex',
    }
    response = test_config.check_if_user_exist('Gina')
    assert response == False
Ejemplo n.º 5
0
def test_get_email_limits_unknown_email():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '*****@*****.**': 'Vapi',
        '*****@*****.**': 'Alex',
    }
    test_config.email_limits = {
        '*****@*****.**': {
            'new': 7,
            'open': 1,
            'rejected': 7,
        }
    }
    response = test_config.get_email_limits('*****@*****.**')
    assert response == {}
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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)