Пример #1
0
    def test_problem_types(self):
        for ptype, internal in problem.PROBLEM_TYPES.items():
            class_name = ptype.lower().capitalize()
            prinstance = getattr(problem, class_name)('Front fell off')
            tools.eq_(prinstance.type, internal)
            tools.eq_(prinstance.analyzer, internal)

        unpr = problem.Unknown('Front not found')
        tools.eq_(unpr.type, 'libreport')
Пример #2
0
    def test_problemify_unknown(self):
        prob = problem.Unknown('Front not found')
        prob._proxy = self.proxy
        prob.add_current_process_data()
        ident = prob.save()

        prob2 = problem.tools.problemify(ident, self.proxy)
        assert type(prob2) == problem.Unknown

        prob.delete()
Пример #3
0
def problemify(probdir, proxy):
    by_analyzer = dict(
        zip(problem.PROBLEM_TYPES.values(), problem.PROBLEM_TYPES.keys()))

    analyzer = proxy.get_item(probdir, 'analyzer')
    reason = proxy.get_item(probdir, 'reason')

    if analyzer not in by_analyzer:
        return problem.Unknown(reason)

    class_name = by_analyzer[analyzer].lower().capitalize()

    prob = getattr(problem, class_name)(reason)
    prob._probdir = probdir
    prob._persisted = True
    prob._proxy = proxy
    return prob
Пример #4
0
def problemify(probdir, proxy):
    by_typ = dict(
        zip(problem.PROBLEM_TYPES.values(), problem.PROBLEM_TYPES.keys()))

    typ = proxy.get_item(probdir, 'type')
    reason = proxy.get_item(probdir, 'reason')

    if typ not in by_typ:
        return problem.Unknown(reason)

    class_name = by_typ[typ].lower().capitalize()

    prob = getattr(problem, class_name)(reason)
    prob._probdir = probdir
    prob._persisted = True
    prob._proxy = proxy
    return prob