Commit 77cb7079 authored by Greg Messner's avatar Greg Messner
Browse files

Fixed issue with target_type when fetching user events (#190).

parent 8158bca1
......@@ -55,7 +55,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action)
.withParam("target_type", targetType)
.withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before)
.withParam("after", after)
.withParam("sort", sortOrder)
......@@ -85,7 +85,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action)
.withParam("target_type", targetType)
.withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before)
.withParam("after", after)
.withParam("sort", sortOrder);
......@@ -137,7 +137,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action)
.withParam("target_type", targetType)
.withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before)
.withParam("after", after)
.withParam("sort", sortOrder)
......@@ -172,7 +172,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action)
.withParam("target_type", targetType)
.withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before)
.withParam("after", after)
.withParam("sort", sortOrder);
......@@ -224,7 +224,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action)
.withParam("target_type", targetType)
.withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before)
.withParam("after", after)
.withParam("sort", sortOrder)
......@@ -259,7 +259,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action)
.withParam("target_type", targetType)
.withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before)
.withParam("after", after)
.withParam("sort", sortOrder);
......
......@@ -118,12 +118,12 @@ public class TestEventsApi {
List<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), null, null, null, null, null);
assertNotNull(events);
}
public void testGetUserEvents1() throws GitLabApiException, ParseException {
@Test
public void testGetUserEventsWithAllParams() throws GitLabApiException, ParseException {
assertNotNull(testUser);
Date before = ISO8601.toDate("2018-06-02");
Date after = ISO8601.toDate("2018-05-01");
Date before = ISO8601.toDate("2017-06-02");
Date after = new Date();
List<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), Constants.ActionType.CREATED, Constants.TargetType.PROJECT, before, after, Constants.SortOrder.DESC);
assertNotNull(events);
}
......@@ -141,13 +141,12 @@ public class TestEventsApi {
assertNotNull(events);
}
// This is commented out because it was causing a "Too Many Requests" error from gitlab.com, thus causing the tests to fail
// @Test
// public void testPagedGetUserEvents() throws GitLabApiException {
// assertNotNull(testUser);
// Pager<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), null, null, null, null, null, 10);
// assertNotNull(events);
// }
@Test
public void testPagedGetUserEvents() throws GitLabApiException {
assertNotNull(testUser);
Pager<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), null, null, null, null, null, 10);
assertNotNull(events);
}
@Test
public void testPagedGetProjectEvents() throws GitLabApiException {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment