Esempio n. 1
0
    def do_check(self, apps, items=None):
        """Check that the available_pane was shown."""
        if items is None:
            items = self.transform_for_test(apps)

        search_text, result_app = app.parse_packages_args(items)

        self.assertEqual(SearchSeparators.REGULAR.join(apps), search_text)
        self.assertIsNone(result_app)
Esempio n. 2
0
    def do_check(self, apps, items=None):
        """Check that the available_pane was shown."""
        if items is None:
            items = self.transform_for_test(apps)

        search_text, result_app = app.parse_packages_args(items)

        self.assertEqual(SearchSeparators.REGULAR.join(apps), search_text)
        self.assertIsNone(result_app)
Esempio n. 3
0
 def test_item_is_a_file(self):
     """Pass an item that is an existing file."""
     # pass a real deb here
     fname = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                          "..", "data", "test_debs", "gdebi-test1.deb")
     assert os.path.exists(fname)
     # test once as string and as list
     for items in ( fname, [fname] ):
         search_text, result_app = app.parse_packages_args(fname)
         self.assertIsInstance(result_app, DebFileApplication)
Esempio n. 4
0
 def test_item_is_a_file(self):
     """Pass an item that is an existing file."""
     # pass a real deb here
     fname = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",
                          "data", "test_debs", "gdebi-test1.deb")
     assert os.path.exists(fname)
     # test once as string and as list
     for items in (fname, [fname]):
         search_text, result_app = app.parse_packages_args(fname)
         self.assertIsInstance(result_app, DebFileApplication)
Esempio n. 5
0
 def test_item_with_file_prefix_one_slash(self):
     """ Pass an existing filename with a file:/ prefix. """
     # pass a real deb here
     orig_fname = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               "..", "data", "test_debs", "gdebi-test1.deb")
     assert os.path.exists(orig_fname)
     for prefix in [ "file:/", "file://", "file:///"]:
         fname = prefix + orig_fname
         # test once as string and as list
         for items in ( fname, [fname] ):
             search_text, result_app = app.parse_packages_args(fname)
             self.assertIsInstance(result_app, DebFileApplication)
Esempio n. 6
0
 def test_item_with_file_prefix_one_slash(self):
     """ Pass an existing filename with a file:/ prefix. """
     # pass a real deb here
     orig_fname = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               "..", "data", "test_debs", "gdebi-test1.deb")
     assert os.path.exists(orig_fname)
     for prefix in ["file:/", "file://", "file:///"]:
         fname = prefix + orig_fname
         # test once as string and as list
         for items in (fname, [fname]):
             search_text, result_app = app.parse_packages_args(fname)
             self.assertIsInstance(result_app, DebFileApplication)
Esempio n. 7
0
    def do_check(self, apps, items=None):
        """Check that the available_pane was shown."""
        if items is None:
            items = self.transform_for_test(apps)

        search_text, result_app = app.parse_packages_args(items)

        if apps and len(apps) == 1 and apps[0] and not os.path.isfile(apps[0]):
            self.assertIsNotNone(result_app)
            app_details = result_app.get_details(self.db)

            self.assertEqual(apps[0], app_details.name)
            state = self.check_package_availability(app_details.name)
            self.assertEqual(state, app_details.pkg_state)
        else:
            self.assertIsNone(result_app)

        if apps and (len(apps) > 1 or os.path.isfile(apps[0])):
            self.assertEqual(SearchSeparators.PACKAGE.join(apps), search_text)
        else:
            self.assertEqual('', search_text)
Esempio n. 8
0
    def do_check(self, apps, items=None):
        """Check that the available_pane was shown."""
        if items is None:
            items = self.transform_for_test(apps)

        search_text, result_app = app.parse_packages_args(items)

        if apps and len(apps) == 1 and apps[0] and not os.path.isfile(apps[0]):
            self.assertIsNotNone(result_app)
            app_details = result_app.get_details(self.db)

            self.assertEqual(apps[0], app_details.name)
            state = self.check_package_availability(app_details.name)
            self.assertEqual(state, app_details.pkg_state)
        else:
            self.assertIsNone(result_app)

        if apps and (len(apps) > 1 or os.path.isfile(apps[0])):
            self.assertEqual(SearchSeparators.PACKAGE.join(apps), search_text)
        else:
            self.assertEqual('', search_text)