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 { ...@@ -55,7 +55,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm() GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action) .withParam("action", action)
.withParam("target_type", targetType) .withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before) .withParam("before", before)
.withParam("after", after) .withParam("after", after)
.withParam("sort", sortOrder) .withParam("sort", sortOrder)
...@@ -85,7 +85,7 @@ public class EventsApi extends AbstractApi { ...@@ -85,7 +85,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm() GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action) .withParam("action", action)
.withParam("target_type", targetType) .withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before) .withParam("before", before)
.withParam("after", after) .withParam("after", after)
.withParam("sort", sortOrder); .withParam("sort", sortOrder);
...@@ -137,7 +137,7 @@ public class EventsApi extends AbstractApi { ...@@ -137,7 +137,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm() GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action) .withParam("action", action)
.withParam("target_type", targetType) .withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before) .withParam("before", before)
.withParam("after", after) .withParam("after", after)
.withParam("sort", sortOrder) .withParam("sort", sortOrder)
...@@ -172,7 +172,7 @@ public class EventsApi extends AbstractApi { ...@@ -172,7 +172,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm() GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action) .withParam("action", action)
.withParam("target_type", targetType) .withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before) .withParam("before", before)
.withParam("after", after) .withParam("after", after)
.withParam("sort", sortOrder); .withParam("sort", sortOrder);
...@@ -224,7 +224,7 @@ public class EventsApi extends AbstractApi { ...@@ -224,7 +224,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm() GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action) .withParam("action", action)
.withParam("target_type", targetType) .withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before) .withParam("before", before)
.withParam("after", after) .withParam("after", after)
.withParam("sort", sortOrder) .withParam("sort", sortOrder)
...@@ -259,7 +259,7 @@ public class EventsApi extends AbstractApi { ...@@ -259,7 +259,7 @@ public class EventsApi extends AbstractApi {
GitLabApiForm formData = new GitLabApiForm() GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action) .withParam("action", action)
.withParam("target_type", targetType) .withParam("target_type", targetType != null ? targetType.toValue().toLowerCase() : null)
.withParam("before", before) .withParam("before", before)
.withParam("after", after) .withParam("after", after)
.withParam("sort", sortOrder); .withParam("sort", sortOrder);
......
...@@ -118,12 +118,12 @@ public class TestEventsApi { ...@@ -118,12 +118,12 @@ public class TestEventsApi {
List<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), null, null, null, null, null); List<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), null, null, null, null, null);
assertNotNull(events); assertNotNull(events);
} }
public void testGetUserEvents1() throws GitLabApiException, ParseException { @Test
public void testGetUserEventsWithAllParams() throws GitLabApiException, ParseException {
assertNotNull(testUser); assertNotNull(testUser);
Date before = ISO8601.toDate("2017-06-02");
Date before = ISO8601.toDate("2018-06-02"); Date after = new Date();
Date after = ISO8601.toDate("2018-05-01");
List<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), Constants.ActionType.CREATED, Constants.TargetType.PROJECT, before, after, Constants.SortOrder.DESC); List<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), Constants.ActionType.CREATED, Constants.TargetType.PROJECT, before, after, Constants.SortOrder.DESC);
assertNotNull(events); assertNotNull(events);
} }
...@@ -141,13 +141,12 @@ public class TestEventsApi { ...@@ -141,13 +141,12 @@ public class TestEventsApi {
assertNotNull(events); 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
// @Test public void testPagedGetUserEvents() throws GitLabApiException {
// public void testPagedGetUserEvents() throws GitLabApiException { assertNotNull(testUser);
// assertNotNull(testUser); Pager<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), null, null, null, null, null, 10);
// Pager<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), null, null, null, null, null, 10); assertNotNull(events);
// assertNotNull(events); }
// }
@Test @Test
public void testPagedGetProjectEvents() throws GitLabApiException { 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