Esempio n. 1
0
def test_project_tree_unknown_element():
    project_tree = ManageProjectElements()
    project_tree.add_element(81818, 0, {'timeworked': 10, 'timeestimated': 20, 'timeleft': 30})
    project_tree.add_element(81819, 81818, {'timeworked': 30, 'timeestimated': 50, 'timeleft': 20})

    response = project_tree.project_tree(3333)
    assert response == []
Esempio n. 2
0
def test_add_element_integers():
    project_tree = ManageProjectElements()
    with pytest.raises(ValueError) as value_error:
        project_tree.add_element('81818', 0, {'timeworked': 10, 'timeestimated': 20, 'timeleft': 30})
    assert 'value error: Expecting integers!' in str(value_error)

    with pytest.raises(ValueError) as value_error:
        project_tree.add_element(81819, '81819', {'timeworked': 10, 'timeestimated': 20, 'timeleft': 30})
    assert 'value error: Expecting integers!' in str(value_error)
Esempio n. 3
0
def test_add_element():
    project_tree = ManageProjectElements()
    project_tree.add_element(81818, 0, {'timeworked': 10, 'timeestimated': 20, 'timeleft': 30})

    assert project_tree.elements.list[0][0] == 81818
    assert project_tree.elements.list[0][1].element == 81818
    assert project_tree.elements.list[0][1].element_time_worked == 10
    assert project_tree.elements.list[0][1].element_time_estimated == 20
    assert project_tree.elements.list[0][1].element_time_left == 30
Esempio n. 4
0
def test_add_element_parent():
    project_tree = ManageProjectElements()
    project_tree.add_element(81818, 0, {'timeworked': 10, 'timeestimated': 20, 'timeleft': 30})
    project_tree.add_element(81819, 81818, {'timeworked': 30, 'timeestimated': 50, 'timeleft': 20})

    assert project_tree.elements.list[0][0] == 81818
    assert project_tree.elements.list[1][0] == 81819
    assert project_tree.elements.list[0][1].children[0].element == 81819
    assert project_tree.elements.list[0][1].project_time_worked == 40
    assert project_tree.elements.list[0][1].project_time_estimated == 70
    assert project_tree.elements.list[0][1].project_time_left == 50
Esempio n. 5
0
def test_project_tree():
    project_tree = ManageProjectElements()
    project_tree.add_element(81818, 0, {'timeworked': 10, 'timeestimated': 20, 'timeleft': 30})
    project_tree.add_element(81819, 81818, {'timeworked': 30, 'timeestimated': 50, 'timeleft': 20})

    response = project_tree.project_tree(81818)
    assert response == [
        81818,
        {'timeworked': 10, 'timeestimated': 20, 'timeleft': 30},
        40,
        70,
        50,
        [
            [
                81819,
                {'timeworked': 30, 'timeestimated': 50, 'timeleft': 20},
                30,
                50,
                20,
                []
            ]
        ]
    ]
Esempio n. 6
0
system = config.get_system()
rt_object = RTApi(system['server'], system['username'], system['password'])

#for aux in range(0, 30):
#    print get_date(aux),
#    print stats_number_of_tickets_of_an_user(rt_object, '*****@*****.**', get_date(aux))
#print stats_update_json_file(28)
#result = stats_read_json_file('2015', '07')
#for day in sorted(result):
#    print day,
#    print 'Created:', result[day]['created_tickets'],
#    print 'Resolved:', result[day]['team']['resolved'],
#    print 'Open:', result[day]['team']['open']
#    print 'Mean time: %0.2f' % result[day]['team']['mean_time_to_resolve']
#pprint(get_statistics('2015-05-01', '2015-07-30'))
#result = full_list_of_tickets_on_a_date(rt_object, config, '2015-07-25')
#pprint(result)

# Project examples:
# 885775
#	887677
#	897183
#   899145
#       899148

project_management = ManageProjectElements()
pprint(get_project_tree(rt_object, project_management, 885775))



Esempio n. 7
0
def test_add_element_unknown_parent():
    project_tree = ManageProjectElements()
    with pytest.raises(ValueError) as value_error:
        project_tree.add_element(81819, 81819, {'timeworked': 10, 'timeestimated': 20, 'timeleft': 30})
    assert 'Parent not inserted yet!' in str(value_error)