forked from gitlab4j/gitlab4j-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestPackageApi.java
56 lines (45 loc) · 1.76 KB
/
TestPackageApi.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package org.gitlab4j.api;
import org.gitlab4j.api.models.*;
import org.gitlab4j.api.models.Package;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.util.*;
@Tag("integration")
@ExtendWith(SetupIntegrationTestExtension.class)
@org.junit.jupiter.api.Disabled("Integration tests are disabled, see https://github.com/gitlab4j/gitlab4j-api/issues/1165")
@TestMethodOrder(MethodOrderer.MethodName.class)
public class TestPackageApi extends AbstractIntegrationTest {
private static GitLabApi gitLabApi;
private static Project testProject;
public TestPackageApi() {
super();
}
@BeforeAll
public static void setup() {
gitLabApi = baseTestSetup();
testProject = getTestProject();
}
@BeforeEach
public void beforeMethod() {
assumeTrue(gitLabApi != null);
assumeTrue(testProject != null);
}
@Disabled("need creation of a package through CI")
@Test
public void getPackagesStream() throws GitLabApiException {
PackagesApi packagesApi = gitLabApi.getPackagesApi();
PackageFilter filter = new PackageFilter()
.withOrderBy(Constants.PackageOrderBy.CREATED_AT)
.withSortOder(Constants.SortOrder.DESC);
Optional<Package> lastPackage = packagesApi.getPackagesStream(testProject.getId(),filter).findAny();
assertTrue(lastPackage.isPresent());
}
}