@Test
@ExtendWith({ RepositoryManagementTestExecutionListener.class,

              ArtifactManagementTestExecutionListener.class })
public void testBrowsePackage(@PypiTestRepository(repositoryId = REPOSITORY_RELEASES, storageId = REPOSITORY_STORAGE) Repository repository,
                              @PypiTestArtifact(storageId = REPOSITORY_STORAGE, id = "hello_world_pypi", versions = { "1.0",
                                                                                                                      "2.0",
                                                                                                                      "3.0",
                                                                                                                      "3.1",
                                                                                                                      "3.2",
                                                                                                                      "3.4",
                                                                                                                      "5.1" }) List<Path> packagePaths)
{
    final String storageId = repository.getStorage().getId();
    final String repositoryId = repository.getId();
    final String url = getContextBaseUrl() + "/storages/{storageId}/{repositoryId}/simple/{packageName}/";
    // All packages list eligible for download :: package not uploaded
    mockMvc.when()
           .get(url, storageId, repositoryId, "hello_world_pypi")
           .then()
           .log()
           .all()
           .statusCode(HttpStatus.OK.value())
           .contentType(ContentType.HTML)
           .body(Matchers.containsString("<title>Not Found</title>"),
                 Matchers.containsString("<h1>Not Found</h1>\n"),
                 Matchers.not(Matchers.containsString("<a href=")));
    // Upload different version of packages generated to be used by
    // next-case
    packagePaths.stream().forEach(path -> {
        final String uploadUrl = getContextBaseUrl() + "/storages/{storageId}/{repositoryId}";
        mockMvc.contentType(MediaType.MULTIPART_FORM_DATA_VALUE)
               .multiPart("filetype", "sdist")
               .multiPart(":action", "file_upload")
               .multiPart("name", "hello_world_pypi")
               .multiPart("metadata_version", "1.0")
               .multiPart("content", path.toFile())
               .when()
               .post(uploadUrl, storageId, repositoryId)
               .then()
               .log()
               .all()
               .statusCode(HttpStatus.OK.value())
               .contentType(ContentType.TEXT)
               .body(Matchers.containsString("The artifact was deployed successfully."));
    });
    // All packages list eligible for download :: package upload
    mockMvc.when()
           .get(url, storageId, repositoryId, "hello_world_pypi")
           .then()
           .log()
           .all()
           .statusCode(HttpStatus.OK.value())
           .contentType(ContentType.HTML)
           .body(Matchers.containsString("<title>Links for hello_world_pypi</title>"),
                 Matchers.containsString("<h1>Links for hello_world_pypi</h1>\n"),
                 Matchers.containsString("<a href="));
}