@pytest.mark.django_db
def test_success(app, admin_user, repository, pypi_stub):
    repository.upstream_pypi_url = pypi_stub.url
    repository.save()
    release_file = ReleaseFileFactory(release__package__repository=repository)

    response = app.get(
        reverse('packages:simple_detail', kwargs={
            'slug': release_file.release.package.name,
            'repo': release_file.release.package.repository.slug
        }))

    assert response.status_code == 200
    assert response.unicode_body in 'Links for test-package'

    a_elms = response.html.select('a')
    assert len(a_elms) == 1
    assert a_elms[0]['href'] == (
        '/repo/default/download/test-package/1/test-1.0.0-sdist.zip' +
        '#md5=62ecd3ee980023db87945470aa2b347b')
    assert a_elms[0]['rel'][0] == 'package'
dataset/ETHPy150Open mvantellingen/localshop/tests/apps/packages/views/test_simple_detail.py/test_success/swapped operands of `in`