Пример #1
0
    def test_available_packages_missed_attr(self):
        filenames, import_mock = self.create_fake_import(name=FAKE_NAME1, check_items=False)

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            with patch('__builtin__.__import__', new=lambda *args: import_mock):
                packages = get_available_packages()

        self.assertFalse(packages)
Пример #2
0
    def test_available_packages_valid_files(self):
        filenames, import_mock = self.create_fake_import(name=FAKE_NAME1)

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            with patch('__builtin__.__import__', new=lambda *args: import_mock):
                packages = get_available_packages()

        self.assertEqual(len(packages), 1)
        self.assertTrue(FAKE_NAME1 in packages)
Пример #3
0
    def test_available_packages_invalid_files(self):
        filenames = [
            '__ini__.py',
            'module.pyc',
        ]

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            packages = get_available_packages()

        self.assertFalse(packages)
Пример #4
0
    def test_available_packages_invalid_files(self):
        filenames = [
            '__ini__.py',
            'module.pyc',
        ]

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            packages = get_available_packages()

        self.assertFalse(packages)
Пример #5
0
    def test_available_packages_missed_attr(self):
        filenames, import_mock = self.create_fake_import(name=FAKE_NAME1,
                                                         check_items=False)

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            with patch('__builtin__.__import__',
                       new=lambda *args: import_mock):
                packages = get_available_packages()

        self.assertFalse(packages)
Пример #6
0
    def test_available_packages_valid_files(self):
        filenames, import_mock = self.create_fake_import(name=FAKE_NAME1)

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            with patch('__builtin__.__import__',
                       new=lambda *args: import_mock):
                packages = get_available_packages()

        self.assertEqual(len(packages), 1)
        self.assertTrue(FAKE_NAME1 in packages)
Пример #7
0
def cache():
    """Output all available to install packages.
    """
    return get_available_packages()
Пример #8
0
    def test_available_packages_type(self):
        packages = get_available_packages()

        self.assertEqual(type(packages), type({}))
Пример #9
0
def cache():
    """Output all available to install packages.
    """
    return get_available_packages()
Пример #10
0
    def test_available_packages_type(self):
        packages = get_available_packages()

        self.assertEqual(type(packages), type({}))