Ejemplo n.º 1
0
    def test_get_package_unknown(self):
        from papaye.views.api import get_package
        from papaye.models import Root
        root = Root()
        self.request.context = root
        self.request.matchdict = {'package_name': 'package1'}

        result = get_package(self.request)

        self.assertIsInstance(result, HTTPNotFound)
Ejemplo n.º 2
0
def test_get_package_unknown(setup):
    from papaye.views.api import get_package
    from papaye.models import Root
    request = testing.DummyRequest()
    root = Root()
    request.context = root
    request.matchdict = {'package_name': 'package1'}

    result = get_package(request)

    assert isinstance(result, HTTPNotFound) is True
Ejemplo n.º 3
0
def test_get_package_unknown(setup):
    from papaye.views.api import get_package
    from papaye.models import Root
    request = testing.DummyRequest()
    root = Root()
    request.context = root
    request.matchdict = {'package_name': 'package1'}

    result = get_package(request)

    assert isinstance(result, HTTPNotFound) is True
Ejemplo n.º 4
0
    def test_get_package(self):
        from papaye.views.api import get_package
        from papaye.models import Package, Root, Release
        root = Root()
        root['package1'] = Package(name='package1')
        root['package2'] = Package(name='package2')
        root['package1']['1.0'] = Release('1.0', '1.0', {
            'summary': 'The package 1',
            'description': 'A description',
        })
        root['package2']['1.0'] = Release('1.0', '1.0', {
            'summary': 'The package 2',
            'description': 'A description',
        })
        self.request.context = root
        self.request.matchdict = {'package_name': 'package1'}

        result = get_package(self.request)

        self.assertIsInstance(result, dict)
        self.assertEqual(result['name'], 'package1')
        self.assertIn('metadata', result)
Ejemplo n.º 5
0
def test_get_package(setup):
    from papaye.views.api import get_package
    from papaye.models import Package, Root, Release
    request = testing.DummyRequest()
    root = Root()
    root['package1'] = Package(name='package1')
    root['package2'] = Package(name='package2')
    root['package1']['1.0'] = Release('1.0', '1.0', {
        'summary': 'The package 1',
        'description': 'A description',
    })
    root['package2']['1.0'] = Release('1.0', '1.0', {
        'summary': 'The package 2',
        'description': 'A description',
    })
    request.context = root
    request.matchdict = {'package_name': 'package1'}

    result = get_package(request)

    assert isinstance(result, dict) is True
    assert result['name'] == 'package1'
    assert 'metadata' in result
Ejemplo n.º 6
0
def test_get_package(setup):
    from papaye.views.api import get_package
    from papaye.models import Package, Root, Release
    request = testing.DummyRequest()
    root = Root()
    root['package1'] = Package(name='package1')
    root['package2'] = Package(name='package2')
    root['package1']['1.0'] = Release('1.0', '1.0', {
        'summary': 'The package 1',
        'description': 'A description',
    })
    root['package2']['1.0'] = Release('1.0', '1.0', {
        'summary': 'The package 2',
        'description': 'A description',
    })
    request.context = root
    request.matchdict = {'package_name': 'package1'}

    result = get_package(request)

    assert isinstance(result, dict) is True
    assert result['name'] == 'package1'
    assert 'metadata' in result