Пример #1
0
    def test_softwarecollection_view_adding_project(self):

        root = get_root()
        softwarecollection = root['softwarecollection'] = SoftwareCollection()
        view = SoftwareCollectionView(root['softwarecollection'],
                                      DummyRequest()).view()
        softwareproject = softwarecollection[
            'softwareproject'] = SoftwareProject()

        assert softwareproject is not None

        assert view is not None

        assert ('items' in view)

        batch = view['items']

        assert type(batch) is plone.batching.batch.BaseBatch

        assert ('api' in view) \
                and (type(view['api']) is kotti.views.util.TemplateAPI)

        assert ('settings' in view) \
                 and ('use_batching' in view['settings']) \
                 and (view['settings']['use_batching'] is True)
        assert ('settings' in view) \
                and ('pagesize' in view['settings']) \
                and (view['settings']['pagesize'] == 5)
        assert ('settings' in view) \
                and ('use_auto_batching' in view['settings']) \
                and (view['settings']['use_auto_batching'] is True)
        assert ('settings' in view) \
                and ('link_headline_overview' in view['settings']) \
                and (view['settings']['link_headline_overview'] is True)
Пример #2
0
    def test_softwareproject_view(self):

        root = get_root()
        softwareproject = root['softwareproject'] = SoftwareProject()

        view = SoftwareProjectView(softwareproject, DummyRequest()).view()

        assert view is not None
Пример #3
0
    def test_software_project_only_bitbucket_owner_and_repo_provided(self):
        root = get_root()
        software_collection = SoftwareCollection()
        root['software_collection'] = software_collection

        software_project = SoftwareProject(bitbucket_owner="pypy",
                                           bitbucket_repo="pypy")

        software_collection['software_project'] = software_project

        assert len(software_collection.values()) == 1
Пример #4
0
    def test_software_project_only_github_owner_and_repo_provided(self):
        root = get_root()
        software_collection = SoftwareCollection()
        root['software_collection'] = software_collection

        software_project = SoftwareProject(github_owner="geojeff",
                                           github_repo="kotti_software")

        software_collection['software_project'] = software_project

        assert len(software_collection.values()) == 1
Пример #5
0
    def test_software_project_only_pypi_url_provided(self):
        root = get_root()
        software_collection = SoftwareCollection()
        root['software_collection'] = software_collection

        software_project = SoftwareProject(
            pypi_url="http://pypi.python.org/pypi/kotti_software/json")

        software_collection['software_project'] = software_project

        assert len(software_collection.values()) == 1
Пример #6
0
    def test_software_project_pypi_overwriting(self):
        root = get_root()
        software_collection = SoftwareCollection()
        root['software_collection'] = software_collection

        software_project = SoftwareProject(
            pypi_url="http://pypi.python.org/pypi/Kotti/json",
            overwrite_home_page_url=True,
            overwrite_docs_url=True,
            overwrite_package_url=True,
            overwrite_bugtrack_url=True,
            desc_handling_choice='use_pypi_summary')

        software_collection['software_project'] = software_project

        assert len(software_collection.values()) == 1

        # desc_handling_choice is an either/or,
        # so also check for description overwriting
        software_project = SoftwareProject(
            pypi_url="http://pypi.python.org/pypi/Kotti/json",
            desc_handling_choice='use_pypi_description')
Пример #7
0
    def test_software_project_bitbucket_data(self):
        root = get_root()
        software_collection = SoftwareCollection()
        root['software_collection'] = software_collection

        software_project = SoftwareProject(
            title="kotti_software Project",
            date_handling_choice="use_bitbucket_date",
            desc_handling_choice="use_bitbucket_description",
            bitbucket_owner="pypy",
            bitbucket_repo="pypy")

        software_collection['software_project'] = software_project

        assert len(software_collection.values()) == 1
Пример #8
0
    def test_software_collection(self):
        root = get_root()
        software_collection = SoftwareCollection()
        assert software_collection.type_info.addable(root,
                                                     DummyRequest()) is True
        root['software_collection'] = software_collection

        software_project = SoftwareProject()

        assert len(software_collection.values()) == 0

        # there are no children of type SoftwareProject yet, the UI should present the add link
        assert software_project.type_info.addable(software_collection,
                                                  DummyRequest()) is True

        software_collection['software_project'] = software_project

        assert len(software_collection.values()) == 1