|
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 |
|
|
Packit |
8ea169 |
class PropertiesTestCase(ProblematicTestCase):
|
|
Packit |
8ea169 |
def test_path(self):
|
|
Packit |
8ea169 |
prob = self.create_problem()
|
|
Packit |
8ea169 |
prob.add_current_process_data()
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
tools.eq_(prob.path, None)
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
prob._probdir = '/tmp/test'
|
|
Packit |
8ea169 |
prob.save()
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
tools.eq_(prob.path, prob._probdir)
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
def test_ids(self):
|
|
Packit |
8ea169 |
prob = self.create_problem()
|
|
Packit |
8ea169 |
prob.add_current_process_data()
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
tools.eq_(prob.id, None)
|
|
Packit |
8ea169 |
tools.eq_(prob.short_id, None)
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
prob.save()
|
|
Packit |
8ea169 |
# fix probdir to test value
|
|
Packit |
8ea169 |
prob._probdir = '/tmp/test'
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
hid = 'f78bf4900bc160fcc5d4e67ae53e392b2775b190'
|
|
Packit |
8ea169 |
tools.eq_(prob.id, hid)
|
|
Packit |
8ea169 |
tools.eq_(prob.short_id, hid[:7])
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
def test_not_reportable_sets_empty_reason(self):
|
|
Packit |
8ea169 |
prob = self.create_problem()
|
|
Packit |
8ea169 |
prob.add_current_process_data()
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
prob.not_reportable = True
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
tools.eq_(prob.not_reportable, True)
|
|
Packit |
8ea169 |
tools.eq_(prob.not_reportable_reason, '')
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
def test_not_reportable_with_reason(self):
|
|
Packit |
8ea169 |
prob = self.create_problem()
|
|
Packit |
8ea169 |
prob.add_current_process_data()
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
prob.not_reportable = True
|
|
Packit |
8ea169 |
prob.not_reportable_reason = 'dunno'
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
tools.eq_(prob.not_reportable, True)
|
|
Packit |
8ea169 |
tools.eq_(prob.not_reportable_reason, 'dunno')
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
def test_not_reportable_reset(self):
|
|
Packit |
8ea169 |
prob = self.create_problem()
|
|
Packit |
8ea169 |
prob.add_current_process_data()
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
prob.not_reportable = True
|
|
Packit |
8ea169 |
prob.not_reportable = False
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
tools.eq_(prob.not_reportable, False)
|
|
Packit |
8ea169 |
tools.eq_(prob.not_reportable_reason, None)
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
if __name__ == '__main__':
|
|
Packit |
8ea169 |
logging.basicConfig(level=logging.DEBUG)
|
|
Packit |
8ea169 |
unittest.main()
|