当前位置: 首页>>代码示例>>Python>>正文


Python tests.create_base_items函数代码示例

本文整理汇总了Python中tests.create_base_items函数的典型用法代码示例。如果您正苦于以下问题:Python create_base_items函数的具体用法?Python create_base_items怎么用?Python create_base_items使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_base_items函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_host_category

    def test_get_host_category(self):
        """ Test the get_host_category function of mirrormanager2.lib. """
        results = mirrormanager2.lib.get_host_category(self.session, 1)
        self.assertEqual(results, None)

        tests.create_base_items(self.session)
        tests.create_site(self.session)
        tests.create_hosts(self.session)
        tests.create_directory(self.session)
        tests.create_category(self.session)
        tests.create_hostcategory(self.session)

        results = mirrormanager2.lib.get_host_category(self.session, 1)
        self.assertEqual(results.host.name, 'mirror.localhost')
        self.assertEqual(results.host.country, 'US')
        results = mirrormanager2.lib.get_host_category(self.session, 2)
        self.assertEqual(results.host.name, 'mirror.localhost')
        self.assertEqual(results.host.country, 'US')
        results = mirrormanager2.lib.get_host_category(self.session, 3)
        self.assertEqual(results.host.name, 'mirror2.localhost')
        self.assertEqual(results.host.country, 'FR')
        results = mirrormanager2.lib.get_host_category(self.session, 4)
        self.assertEqual(results.host.name, 'mirror2.localhost')
        self.assertEqual(results.host.country, 'FR')
        results = mirrormanager2.lib.get_host_category(self.session, 5)
        self.assertEqual(results, None)
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:26,代码来源:test_mmlib.py

示例2: test_get_repo_by_name

    def test_get_repo_by_name(self):
        """ Test the get_repo_by_name function of mirrormanager2.lib.
        """
        results = mirrormanager2.lib.get_repo_by_name(
            self.session, 'pub/fedora/linux/updates/testing/19/x86_64')
        self.assertEqual(results, None)

        tests.create_base_items(self.session)
        tests.create_version(self.session)
        tests.create_directory(self.session)
        tests.create_category(self.session)
        tests.create_repository(self.session)

        results = mirrormanager2.lib.get_repo_by_name(
            self.session, 'pub/fedora/linux/updates/testing/19/x86_64')
        self.assertEqual(
            results.name, 'pub/fedora/linux/updates/testing/19/x86_64')

        results = mirrormanager2.lib.get_repo_by_name(
            self.session, 'pub/fedora/linux/updates/testing/20/x86_64')
        self.assertEqual(
            results.name, 'pub/fedora/linux/updates/testing/20/x86_64')

        results = mirrormanager2.lib.get_repo_by_name(
            self.session, 'pub/fedora/linux/updates/testing/19/i386')
        self.assertEqual(results, None)
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:26,代码来源:test_mmlib.py

示例3: test_get_version_by_name_version

    def test_get_version_by_name_version(self):
        """ Test the get_version_by_name_version function of
        mirrormanager2.lib.
        """
        results = mirrormanager2.lib.get_version_by_name_version(
            self.session, 'Fedora', '21')
        self.assertEqual(results, None)

        tests.create_base_items(self.session)
        tests.create_version(self.session)

        results = mirrormanager2.lib.get_version_by_name_version(
            self.session, 'Fedora', 21)
        self.assertEqual(results.product.name, 'Fedora')
        self.assertEqual(results.name, '21')

        results = mirrormanager2.lib.get_version_by_name_version(
            self.session, 'Fedora', '21-alpha')
        self.assertEqual(results.product.name, 'Fedora')
        self.assertEqual(results.name, '21-alpha')
        self.assertEqual(results.is_test, True)

        results = mirrormanager2.lib.get_session_by_visitkey(
                self.session, 'bar')
        self.assertEqual(results, None)
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:25,代码来源:test_mmlib.py

示例4: setUp

    def setUp(self):
        """ Set up the environnment, ran before every test. """
        super(FlaskUiAdminTest, self).setUp()

        mirrormanager2.app.APP.config['TESTING'] = True
        mirrormanager2.app.SESSION = self.session
        mirrormanager2.app.ADMIN.SESSION = self.session
        mirrormanager2.app.APP.SESSION = self.session
        mirrormanager2.admin.SESSION = self.session
        mirrormanager2.admin.ADMIN.SESSION = self.session
        mirrormanager2.admin.APP.SESSION = self.session
        for view in mirrormanager2.admin.VIEWS:
            view.session = self.session
        self.app = mirrormanager2.app.APP.test_client()

        # Fill the DB a little bit
        tests.create_base_items(self.session)
        tests.create_site(self.session)
        tests.create_site_admin(self.session)
        tests.create_hosts(self.session)
        tests.create_location(self.session)
        tests.create_netblockcountry(self.session)
        tests.create_directory(self.session)
        tests.create_category(self.session)
        tests.create_hostcategory(self.session)
        tests.create_hostcategoryurl(self.session)
        tests.create_hostcategorydir(self.session)
        tests.create_categorydirectory(self.session)
        tests.create_version(self.session)
        tests.create_repository(self.session)
        tests.create_repositoryredirect(self.session)
开发者ID:fedora-infra,项目名称:mirrormanager2,代码行数:31,代码来源:test_ui_admin.py

示例5: test_get_host_category_url_by_id

    def test_get_host_category_url_by_id(self):
        """ Test the get_host_category_url_by_id function of
        mirrormanager2.lib.
        """
        results = mirrormanager2.lib.get_host_category_url_by_id(
            self.session, 1)
        self.assertEqual(results, None)

        tests.create_base_items(self.session)
        tests.create_site(self.session)
        tests.create_hosts(self.session)
        tests.create_directory(self.session)
        tests.create_category(self.session)
        tests.create_hostcategory(self.session)
        tests.create_hostcategoryurl(self.session)

        for i in range(4):
            results = mirrormanager2.lib.get_host_category_url_by_id(
                self.session, i+1)
            self.assertEqual(
                results.host_category.host.name, 'mirror.localhost')
            self.assertEqual(
                results.host_category.host.country, 'US')

        results = mirrormanager2.lib.get_host_category_url_by_id(
            self.session, 5)
        self.assertEqual(results, None)
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:27,代码来源:test_mmlib.py

示例6: test_get_host_category_by_hostid_category

    def test_get_host_category_by_hostid_category(self):
        """ Test the get_host_category_by_hostid_category function of
        mirrormanager2.lib.
        """
        results = mirrormanager2.lib.get_host_category_by_hostid_category(
            self.session, 1, 'Fedora Linux')
        self.assertEqual(results, [])

        tests.create_base_items(self.session)
        tests.create_site(self.session)
        tests.create_hosts(self.session)
        tests.create_directory(self.session)
        tests.create_category(self.session)
        tests.create_hostcategory(self.session)

        results = mirrormanager2.lib.get_host_category_by_hostid_category(
            self.session, 1, 'Fedora Linux')
        self.assertEqual(len(results), 1)
        self.assertEqual(results[0].host.name, 'mirror.localhost')
        self.assertEqual(results[0].host.country, 'US')

        results = mirrormanager2.lib.get_host_category_by_hostid_category(
            self.session, 2, 'Fedora Linux')
        self.assertEqual(len(results), 1)
        self.assertEqual(results[0].host.name, 'mirror2.localhost')
        self.assertEqual(results[0].host.country, 'FR')

        results = mirrormanager2.lib.get_host_category_by_hostid_category(
            self.session, 3, 'Fedora Linux')
        self.assertEqual(results, [])
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:30,代码来源:test_mmlib.py

示例7: test_get_repositories

    def test_get_repositories(self):
        """ Test the get_repositories function of mirrormanager2.lib.
        """
        results = mirrormanager2.lib.get_repositories(self.session)
        self.assertEqual(results, [])

        tests.create_base_items(self.session)
        tests.create_version(self.session)
        tests.create_directory(self.session)
        tests.create_category(self.session)
        tests.create_repository(self.session)

        results = mirrormanager2.lib.get_repositories(self.session)
        self.assertEqual(len(results), 3)
        self.assertEqual(
            results[0].name, 'pub/fedora/linux/updates/testing/19/x86_64')
        self.assertEqual(results[0].arch.name, 'x86_64')

        self.assertEqual(
            results[1].name, 'pub/fedora/linux/updates/testing/20/x86_64')
        self.assertEqual(results[1].arch.name, 'x86_64')

        self.assertEqual(
            results[2].name, 'pub/fedora/linux/updates/testing/21/x86_64')
        self.assertEqual(results[2].arch.name, 'x86_64')
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:25,代码来源:test_mmlib.py

示例8: test_get_directory_exclusive_host

    def test_get_directory_exclusive_host(self):
        """ Test the get_directory_exclusive_host function of
        mirrormanager2.lib.
        """
        results = mirrormanager2.lib.get_directory_exclusive_host(
            self.session)
        self.assertEqual(results, [])

        tests.create_base_items(self.session)
        tests.create_site(self.session)
        tests.create_hosts(self.session)
        tests.create_directory(self.session)
        tests.create_directoryexclusivehost(self.session)

        results = mirrormanager2.lib.get_directory_exclusive_host(
            self.session)
        self.assertEqual(len(results), 2)
        self.assertEqual(
            results[0].dname, 'pub/fedora/linux/releases/20')
        self.assertEqual(
            results[0].host_id, 1)
        self.assertEqual(
            results[1].dname, 'pub/fedora/linux/releases/21')
        self.assertEqual(
            results[1].host_id, 3)
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:25,代码来源:test_mmlib.py

示例9: test_product_repr

    def test_product_repr(self):
        """ Test the Product.__repr__ object of mirrormanager2.lib.model.
        """
        tests.create_base_items(self.session)

        item = model.Product.get(self.session, 1)
        self.assertEqual(str(item), '<Product(1 - EPEL)>')
        item = model.Product.get(self.session, 2)
        self.assertEqual(str(item), '<Product(2 - Fedora)>')
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:9,代码来源:test_mm_lib_model.py

示例10: test_arch_repr

    def test_arch_repr(self):
        """ Test the Arch.__repr__ object of mirrormanager2.lib.model.
        """
        tests.create_base_items(self.session)

        item = model.Arch.get(self.session, 1)
        self.assertEqual(str(item), '<Arch(1 - source)>')
        item = model.Arch.get(self.session, 2)
        self.assertEqual(str(item), '<Arch(2 - i386)>')
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:9,代码来源:test_mm_lib_model.py

示例11: test_user_username

    def test_user_username(self):
        """ Test the User.username object of mirrormanager2.lib.model.
        """
        tests.create_base_items(self.session)
        tests.create_user_groups(self.session)

        for index, string in enumerate(['pingou', 'kevin', 'ralph', 'shaiton']):
            item = model.User.get(self.session, index + 1)
            self.assertEqual(item.username, string)
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:9,代码来源:test_mm_lib_model.py

示例12: test_mirrormanagerbasemixin

    def test_mirrormanagerbasemixin(self):
        """ Test the MirrorManagerBaseMixin object of
        mirrormanager2.lib.model.
        """
        tests.create_base_items(self.session)

        item = model.Arch.get(self.session, 1)
        self.assertEqual(item.name, 'source')
        item = model.Arch.get(self.session, 3)
        self.assertEqual(item.name, 'x86_64')
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:10,代码来源:test_mm_lib_model.py

示例13: test_group_repr

    def test_group_repr(self):
        """ Test the Group.__repr__ object of mirrormanager2.lib.model.
        """
        tests.create_base_items(self.session)
        tests.create_user_groups(self.session)

        item = model.Group.get(self.session, 1)
        self.assertEqual(str(item), 'Group: 1 - name fpca')
        item = model.Group.get(self.session, 2)
        self.assertEqual(str(item), 'Group: 2 - name packager')
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:10,代码来源:test_mm_lib_model.py

示例14: test_version_repr

    def test_version_repr(self):
        """ Test the Version.__repr__ object of mirrormanager2.lib.model.
        """
        tests.create_base_items(self.session)
        tests.create_version(self.session)

        item = model.Version.get(self.session, 1)
        self.assertEqual(str(item), '<Version(1 - 20)>')
        item = model.Version.get(self.session, 2)
        self.assertEqual(str(item), '<Version(2 - 21-alpha)>')
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:10,代码来源:test_mm_lib_model.py

示例15: test_directory_repr

    def test_directory_repr(self):
        """ Test the Directory.__repr__ object of mirrormanager2.lib.model.
        """
        tests.create_base_items(self.session)
        tests.create_directory(self.session)

        item = model.Directory.get(self.session, 1)
        self.assertEqual(
            str(item), '<Directory(1 - pub/fedora/linux/releases)>')
        item = model.Directory.get(self.session, 3)
        self.assertEqual(str(item), '<Directory(3 - pub/epel)>')
开发者ID:Devyani-Divs,项目名称:mirrormanager2,代码行数:11,代码来源:test_mm_lib_model.py


注:本文中的tests.create_base_items函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。