예제 #1
0
def test_to_obj_valid(reset_db, store_example):
    # Tests that a TrackedProgram object is initialized correctly with valid values
    name, start, end_time, time_left, max_time = store_example
    result = DataManager.query("SELECT * FROM program_log", single=True)
    obj = DataManager.to_obj(result)

    assert obj.db_id == 1
    assert obj.name == name
    assert obj.start_time == start
    assert obj.end_time == end_time
    assert obj._time_left == time_left
    assert obj.max_time == max_time
예제 #2
0
def test_to_obj_invalid(reset_db, dict_params, attribute, value):
    # Tests that exception is raised from invalid value
    dict_params[attribute] = value
    dict_params[attribute] = value
    with pytest.raises(ValueError) as e_info:
        obj = DataManager.to_obj(dict_params)