import unittest from tests.utils import ( setup_test_env, ) setup_test_env() from softwarecenter.distro import get_distro class TestDistro(unittest.TestCase): """ tests the distro class """ def test_get_distro(self): distro = get_distro() self.assertNotEqual(distro, None) def test_distro_functions(self): distro = get_distro() codename = distro.get_codename() self.assertNotEqual(codename, None) myname = distro.get_app_name() self.assertTrue(len(myname) > 0) arch = distro.get_architecture() self.assertNotEqual(arch, None) if __name__ == "__main__": unittest.main()
import os import unittest from tests.utils import ( DATA_DIR, get_test_db, setup_test_env, ) setup_test_env() from softwarecenter.enums import PkgStates from softwarecenter.db.debfile import DebFileApplication, DebFileOpenError DEBFILE_DIR = os.path.join(DATA_DIR, 'test_debs') DEBFILE_PATH = os.path.join(DEBFILE_DIR, 'gdebi-test9.deb') DEBFILE_NAME = 'gdebi-test9' DEBFILE_DESCRIPTION = ' provides/conflicts against "nvidia-glx"' DEBFILE_SUMMARY = 'testpackage for gdebi - provides/conflicts against real pkg' DEBFILE_VERSION = '1.0' DEBFILE_WARNING = 'Only install this file if you trust the origin.' DEBFILE_PATH_NOTFOUND = os.path.join(DEBFILE_DIR, 'notfound.deb') DEBFILE_PATH_NOTADEB = os.path.join(DATA_DIR, 'notadeb.txt') DEBFILE_PATH_CORRUPT = os.path.join(DEBFILE_DIR, 'corrupt.deb') DEBFILE_NOT_INSTALLABLE = os.path.join(DEBFILE_DIR, 'gdebi-test1.deb') class TestDebFileApplication(unittest.TestCase): """ Test the class DebFileApplication """