コード例 #1
0
    def test_with_no_package_id_exists(self):
        """
        No package with id exists. Raises error.
        """
        context = {"session": model.Session}

        with pytest.raises(toolkit.Invalid):
            convert_package_name_or_id_to_title_or_name(
                "my-non-existent-id",
                context=context,
            )
コード例 #2
0
    def test_id_to_name(self):
        '''
        Package with no title correctly returns name.
        '''
        context = {'session': model.Session}
        factories.Dataset(id='my-id', title='', name='my-name')

        result = convert_package_name_or_id_to_title_or_name('my-id', context)
        nosetools.assert_equals('my-name', result)
コード例 #3
0
    def test_id_to_name(self):
        '''
        Package with no title correctly returns name.
        '''
        context = {'session': model.Session}
        factories.Dataset(id='my-id', title='', name='my-name')

        result = convert_package_name_or_id_to_title_or_name('my-id', context)
        nosetools.assert_equals('my-name', result)
コード例 #4
0
    def test_id_to_name(self):
        """
        Package with no title correctly returns name.
        """
        context = {"session": model.Session}
        factories.Dataset(id="my-id", title="", name="my-name")

        result = convert_package_name_or_id_to_title_or_name("my-id", context)
        assert "my-name" == result