Blame src/python-problem/tests/test_get.py
|
Packit |
8ea169 |
#!/usr/bin/env python3
|
|
Packit |
8ea169 |
import os
|
|
Packit |
8ea169 |
import sys
|
|
Packit |
8ea169 |
import logging
|
|
Packit |
8ea169 |
import unittest
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
sys.path.insert(0, os.path.abspath(".."))
|
|
Packit |
8ea169 |
sys.path.insert(0, os.path.abspath("../problem/.libs")) # because of _pyabrt
|
|
Packit |
8ea169 |
os.environ["PATH"] = "{0}:{1}".format(os.path.abspath(".."), os.environ["PATH"])
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
from nose import tools
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
from base import ProblematicTestCase
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
import problem
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
class GetTestCase(ProblematicTestCase):
|
|
Packit |
8ea169 |
def test_get(self):
|
|
Packit |
8ea169 |
prob = self.create_problem()
|
|
Packit |
8ea169 |
prob.add_current_process_data()
|
|
Packit |
8ea169 |
ident = prob.save()
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
prob2 = problem.get(ident, False, self.proxy)
|
|
Packit |
8ea169 |
prob3 = problem.get(ident, True, self.proxy)
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
tools.eq_(prob.reason, prob2.reason)
|
|
Packit |
8ea169 |
tools.eq_(prob.reason, prob3.reason)
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
prob.delete()
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
def test_get_nonexistent(self):
|
|
Packit |
8ea169 |
tools.ok_(problem.get('random', False, self.proxy) is None)
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
if __name__ == '__main__':
|
|
Packit |
8ea169 |
logging.basicConfig(level=logging.DEBUG)
|
|
Packit |
8ea169 |
unittest.main()
|