Exemple #1
0
    def test_lookup_path(self, app):
        n = Namespace(name='Hello')
        p = Package(name='Dog Bog', namespace=n)
        p.save()

        expected_path = 'hello/dog-bog'

        assert Package.lookup_path(expected_path) == p
Exemple #2
0
def get_package(namespace_slug, package_slug):
    path = f'{namespace_slug}/{package_slug}'
    match = Package.lookup_path(path)

    if match is None:
        raise PackageNotFoundErrorResponse(path)

    return match