From 7a02db83477b5cb63dbf325f98011c458d10de64 Mon Sep 17 00:00:00 2001 From: Priyanka Lakhe Date: Fri, 27 Oct 2023 18:10:15 -0700 Subject: [PATCH] Part 4 of unit test coverage + tiny readme update to add developer agreement link (#74) * add legal agreement to README.md * adding tests to UserResourcesImplTest * adding tests to SightResourcesImplTest * code style fixes * code review comments - part 1 --------- Co-authored-by: Priyanka Lakhe --- README.md | 3 + .../api/internal/SightResourcesImpl.java | 16 +- .../java/com/smartsheet/api/models/Group.java | 2 +- .../java/com/smartsheet/api/models/Sight.java | 2 +- .../api/internal/SightResourcesImplTest.java | 150 +++++++++++++++++ .../api/internal/UserResourcesImplTest.java | 151 +++++++++++++++++- src/test/resources/addAlternateEmail.json | 16 ++ src/test/resources/getAlternateEmail.json | 4 + .../getCurrentUserIncludesGroups.json | 23 +++ src/test/resources/getSight.json | 19 +++ src/test/resources/getSightPublishStatus.json | 5 + src/test/resources/listAlternateEmails.json | 17 ++ src/test/resources/listSights.json | 27 ++++ src/test/resources/promoteAlternateEmail.json | 9 ++ src/test/resources/setSightPublishStatus.json | 10 ++ src/test/resources/updateSight.json | 24 +++ 16 files changed, 466 insertions(+), 12 deletions(-) create mode 100644 src/test/resources/addAlternateEmail.json create mode 100644 src/test/resources/getAlternateEmail.json create mode 100644 src/test/resources/getCurrentUserIncludesGroups.json create mode 100644 src/test/resources/getSight.json create mode 100644 src/test/resources/getSightPublishStatus.json create mode 100644 src/test/resources/listAlternateEmails.json create mode 100644 src/test/resources/listSights.json create mode 100644 src/test/resources/promoteAlternateEmail.json create mode 100644 src/test/resources/setSightPublishStatus.json create mode 100644 src/test/resources/updateSight.json diff --git a/README.md b/README.md index b581b3e2..55b2b77d 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,9 @@ Each specific release is available for download via [Github](https://github.com/ See +## Developer Agreement +Review the [Developer Program Agreement](https://www.smartsheet.com/legal/developer-program-agreement). + ## Acknowledgements We would like to thank the following people for their contributions to this project: diff --git a/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java b/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java index 7e41149e..c03a4fd5 100644 --- a/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java +++ b/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java @@ -90,7 +90,7 @@ public PagedResult listSights(PaginationParameters paging, Date modifiedS *

* It mirrors to the following Smartsheet REST API method: GET /sights/{sightId} * - * @param sightId the Id of the Sight + * @param sightId the id of the Sight * @return the Sight resource. * @throws IllegalArgumentException if any argument is null or empty string * @throws InvalidRequestException if there is any problem with the REST API request @@ -108,7 +108,7 @@ public Sight getSight(long sightId) throws SmartsheetException { *

* It mirrors to the following Smartsheet REST API method: GET /sights/{sightId} * - * @param sightId the Id of the Sight + * @param sightId the id of the Sight * @param level compatibility level * @return the Sight resource. * @throws IllegalArgumentException if any argument is null or empty string @@ -127,7 +127,7 @@ public Sight getSight(long sightId, Integer level) throws SmartsheetException { *

* It mirrors to the following Smartsheet REST API method: GET /sights/{sightId} * - * @param sightId the Id of the Sight + * @param sightId the id of the Sight * @param level compatibility level * @param includes optional parameters to include * @return the Sight resource. @@ -173,7 +173,7 @@ public Sight updateSight(Sight sight) throws SmartsheetException { *

* It mirrors to the following Smartsheet REST API method: DELETE /sights/{sightId} * - * @param sightId the Id of the Sight + * @param sightId the id of the Sight * * @throws IllegalArgumentException if any argument is null or empty string * @throws InvalidRequestException if there is any problem with the REST API request @@ -191,7 +191,7 @@ public void deleteSight(long sightId) throws SmartsheetException { *

* It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/copy * - * @param sightId the Id of the Sight + * @param sightId the id of the Sight * @param destination the destination to copy to * @return the newly created Sight resource. * @throws IllegalArgumentException if any argument is null or empty string @@ -210,7 +210,7 @@ public Sight copySight(long sightId, ContainerDestination destination) throws Sm *

* It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/move * - * @param sightId the Id of the Sight + * @param sightId the id of the Sight * @param destination the destination to copy to * @return the newly created Sight resource. * @throws IllegalArgumentException if any argument is null or empty string @@ -229,7 +229,7 @@ public Sight moveSight(long sightId, ContainerDestination destination) throws Sm *

* It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/publish * - * @param sightId the Id of the Sight + * @param sightId the id of the Sight * @return the Sight's publish status. * @throws IllegalArgumentException if any argument is null or empty string * @throws InvalidRequestException if there is any problem with the REST API request @@ -247,7 +247,7 @@ public SightPublish getPublishStatus(long sightId) throws SmartsheetException { *

* It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/publish * - * @param sightId the Id of the Sight + * @param sightId the id of the Sight * @param sightPublish the SightPublish object containing publish status * @return the Sight's publish status. * @throws IllegalArgumentException if any argument is null or empty string diff --git a/src/main/java/com/smartsheet/api/models/Group.java b/src/main/java/com/smartsheet/api/models/Group.java index d4a40adc..c1cd9e5c 100644 --- a/src/main/java/com/smartsheet/api/models/Group.java +++ b/src/main/java/com/smartsheet/api/models/Group.java @@ -36,7 +36,7 @@ public class Group extends NamedModel { private String owner; /** - * The the id of the owner of the group. + * The id of the owner of the group. */ private Long ownerId; diff --git a/src/main/java/com/smartsheet/api/models/Sight.java b/src/main/java/com/smartsheet/api/models/Sight.java index fc10ddff..58195fdc 100644 --- a/src/main/java/com/smartsheet/api/models/Sight.java +++ b/src/main/java/com/smartsheet/api/models/Sight.java @@ -64,7 +64,7 @@ public class Sight extends NamedModel { private Source source; /** - * A workspace object, limited to only Id and Name + * A workspace object, limited to only id and Name */ private Workspace workspace; diff --git a/src/test/java/com/smartsheet/api/internal/SightResourcesImplTest.java b/src/test/java/com/smartsheet/api/internal/SightResourcesImplTest.java index 4ddcfe15..4483dc53 100644 --- a/src/test/java/com/smartsheet/api/internal/SightResourcesImplTest.java +++ b/src/test/java/com/smartsheet/api/internal/SightResourcesImplTest.java @@ -16,11 +16,25 @@ package com.smartsheet.api.internal; +import com.smartsheet.api.SmartsheetException; import com.smartsheet.api.internal.http.DefaultHttpClient; +import com.smartsheet.api.models.PagedResult; +import com.smartsheet.api.models.PaginationParameters; +import com.smartsheet.api.models.ContainerDestination; +import com.smartsheet.api.models.Sight; +import com.smartsheet.api.models.SightPublish; +import com.smartsheet.api.models.enums.AccessLevel; +import com.smartsheet.api.models.enums.SightInclusion; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; +import java.util.EnumSet; + +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.assertThatCode; class SightResourcesImplTest extends ResourcesImplBase { private SightResourcesImpl sightResourcesImpl; @@ -36,9 +50,145 @@ public void before() { sightResourcesImpl = new SightResourcesImpl(smartsheetImpl); } + @Test + void testListSights() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/listSights.json")); + + PaginationParameters pagination = new PaginationParameters(); + pagination.setIncludeAll(true); + pagination.setPageSize(1); + pagination.setPage(1); + + PagedResult sightPagedResult = sightResourcesImpl.listSights(pagination, null); + assertThat(sightPagedResult.getData()).isNotNull(); + assertThat(sightPagedResult.getData()).isNotEmpty(); + assertThat(sightPagedResult.getData()).hasSize(1); + assertThat(sightPagedResult.getData().get(0).getAccessLevel()).isEqualTo(AccessLevel.VIEWER); + assertThat(sightPagedResult.getData().get(0).getFavorite()).isFalse(); + assertThat(sightPagedResult.getData().get(0).getWidgets()).isEmpty(); + assertThat(sightPagedResult.getData().get(0).getWorkspace()).isNotNull(); + assertThat(sightPagedResult.getData().get(0).getPermalink()).isNotBlank(); + } + + @Test + void testGetSight() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/getSight.json")); + + Sight sight = sightResourcesImpl.getSight(12345L); + assertThat(sight).isNotNull(); + assertThat(sight.getAccessLevel()).isEqualTo(AccessLevel.VIEWER); + assertThat(sight.getFavorite()).isFalse(); + assertThat(sight.getWidgets()).isEmpty(); + assertThat(sight.getWorkspace()).isNotNull(); + assertThat(sight.getPermalink()).isNotBlank(); + } + + @Test + void testGetSightWithLevel() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/getSight.json")); + + Sight sight = sightResourcesImpl.getSight(12345L, 1); + assertThat(sight).isNotNull(); + assertThat(sight.getAccessLevel()).isEqualTo(AccessLevel.VIEWER); + assertThat(sight.getFavorite()).isFalse(); + assertThat(sight.getWidgets()).isEmpty(); + assertThat(sight.getWorkspace()).isNotNull(); + assertThat(sight.getPermalink()).isNotBlank(); + } + + @Test + void testGetSightWithLevelAndSightInclusion() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/getSight.json")); + + EnumSet includes = EnumSet.of(SightInclusion.SOURCE); + + Sight sight = sightResourcesImpl.getSight(12345L, includes, 1); + assertThat(sight).isNotNull(); + assertThat(sight.getAccessLevel()).isEqualTo(AccessLevel.VIEWER); + assertThat(sight.getFavorite()).isFalse(); + assertThat(sight.getWidgets()).isEmpty(); + assertThat(sight.getWorkspace()).isNotNull(); + assertThat(sight.getPermalink()).isNotBlank(); + } + + @Test + void testUpdateSight_SightNull() { + assertThatThrownBy(() -> { + sightResourcesImpl.updateSight(null); + }).isInstanceOf(IllegalArgumentException.class); + } + + @Test + void testUpdateSight() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/updateSight.json")); + + PaginationParameters pagination = new PaginationParameters(); + pagination.setIncludeAll(true); + pagination.setPageSize(1); + pagination.setPage(1); + + Sight sight = sightResourcesImpl.updateSight(new Sight()); + assertThat(sight).isNotNull(); + assertThat(sight.getAccessLevel()).isEqualTo(AccessLevel.VIEWER); + assertThat(sight.getFavorite()).isFalse(); + assertThat(sight.getWidgets()).isEmpty(); + assertThat(sight.getWorkspace()).isNotNull(); + assertThat(sight.getPermalink()).isNotBlank(); + } + @Test void updateWithNullSight() { assertThatThrownBy(() -> sightResourcesImpl.updateSight(null)) .isInstanceOf(IllegalArgumentException.class); } + + @Test + void testDeleteSight() throws IOException { + server.setResponseBody(new File("src/test/resources/updateSight.json")); + assertThatCode(() -> sightResourcesImpl.deleteSight(12345L)).doesNotThrowAnyException(); + } + + @Test + void testSetPublishStatus() throws IOException, SmartsheetException { + server.setResponseBody(new File("src/test/resources/setSightPublishStatus.json")); + SightPublish sightPublish = sightResourcesImpl.setPublishStatus(1234L, new SightPublish()); + assertThat(sightPublish.getReadOnlyFullAccessibleBy()).isEqualTo(Boolean.FALSE.toString()); + assertThat(sightPublish.getReadOnlyFullEnabled()).isEqualTo(Boolean.FALSE); + assertThat(sightPublish.getReadOnlyFullUrl()).isNotBlank(); + } + + @Test + void testGetPublishStatus() throws IOException, SmartsheetException { + server.setResponseBody(new File("src/test/resources/getSightPublishStatus.json")); + SightPublish sightPublish = sightResourcesImpl.getPublishStatus(1234L); + assertThat(sightPublish.getReadOnlyFullAccessibleBy()).isEqualTo(Boolean.FALSE.toString()); + assertThat(sightPublish.getReadOnlyFullEnabled()).isEqualTo(Boolean.FALSE); + assertThat(sightPublish.getReadOnlyFullUrl()).isNotBlank(); + } + + @Test + void testCopySight() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/updateSight.json")); + + Sight sight = sightResourcesImpl.copySight(12345L, new ContainerDestination()); + assertThat(sight).isNotNull(); + assertThat(sight.getAccessLevel()).isEqualTo(AccessLevel.VIEWER); + assertThat(sight.getFavorite()).isFalse(); + assertThat(sight.getWidgets()).isEmpty(); + assertThat(sight.getWorkspace()).isNotNull(); + assertThat(sight.getPermalink()).isNotBlank(); + } + + @Test + void testMoveSight() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/updateSight.json")); + + Sight sight = sightResourcesImpl.moveSight(12345L, new ContainerDestination()); + assertThat(sight).isNotNull(); + assertThat(sight.getAccessLevel()).isEqualTo(AccessLevel.VIEWER); + assertThat(sight.getFavorite()).isFalse(); + assertThat(sight.getWidgets()).isEmpty(); + assertThat(sight.getWorkspace()).isNotNull(); + assertThat(sight.getPermalink()).isNotBlank(); + } } diff --git a/src/test/java/com/smartsheet/api/internal/UserResourcesImplTest.java b/src/test/java/com/smartsheet/api/internal/UserResourcesImplTest.java index 67aafe1d..a6e78f33 100644 --- a/src/test/java/com/smartsheet/api/internal/UserResourcesImplTest.java +++ b/src/test/java/com/smartsheet/api/internal/UserResourcesImplTest.java @@ -19,23 +19,30 @@ import com.smartsheet.api.SmartsheetException; import com.smartsheet.api.internal.http.DefaultHttpClient; import com.smartsheet.api.models.Account; +import com.smartsheet.api.models.AlternateEmail; import com.smartsheet.api.models.DeleteUserParameters; import com.smartsheet.api.models.PagedResult; import com.smartsheet.api.models.PaginationParameters; import com.smartsheet.api.models.Sheet; import com.smartsheet.api.models.User; import com.smartsheet.api.models.UserProfile; +import com.smartsheet.api.models.enums.UserInclusion; import com.smartsheet.api.models.enums.UserStatus; +import org.assertj.core.util.Lists; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; +import java.util.EnumSet; import java.util.HashSet; import java.util.List; import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.assertThatCode; class UserResourcesImplTest extends ResourcesImplBase { @@ -144,6 +151,29 @@ void testGetCurrentUser() throws SmartsheetException, IOException { assertThat(account.getId().longValue()).isEqualTo(111111111111L); } + @Test + void testGetCurrentUser_withIncludesExcludes() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/getCurrentUserIncludesGroups.json")); + + EnumSet includes = EnumSet.of(UserInclusion.GROUPS); + UserProfile user = userResources.getCurrentUser(includes); + assertThat(user.getEmail()).isEqualTo("test@smartsheet.com"); + assertThat(user.getId().longValue()).isEqualTo(2222222222L); + assertThat(user.getFirstName()).isEqualTo("John"); + assertThat(user.getLastName()).isEqualTo("Doe"); + assertThat(user.getLocale()).isEqualTo("en_US"); + assertThat(user.getTimeZone()).isEqualTo("US/Pacific"); + + Account account = user.getAccount(); + assertThat(account.getName()).isEqualTo("Smartsheet"); + assertThat(account.getId().longValue()).isEqualTo(111111111111L); + + // has groups + assertThat(user.getGroups()).hasSize(1); + assertThat(user.getGroups().get(0).getId()).isEqualTo(456456L); + assertThat(user.getGroups().get(0).getOwner()).isEqualTo("jane.doe@smartsheet.com"); + } + @Test void testUpdateUser() throws SmartsheetException, IOException { server.setResponseBody(new File("src/test/resources/updateUser.json")); @@ -161,10 +191,10 @@ void testUpdateUser() throws SmartsheetException, IOException { } @Test - void testDeleteUser() throws IOException, SmartsheetException { + void testDeleteUser() throws IOException { server.setResponseBody(new File("src/test/resources/deleteUser.json")); DeleteUserParameters parameters = new DeleteUserParameters(12345L, true, true); - userResources.deleteUser(1234L, parameters); + assertThatCode(() -> userResources.deleteUser(1234L, parameters)).doesNotThrowAnyException(); } @Test @@ -177,5 +207,122 @@ void testListOrgSheets() throws SmartsheetException, IOException { pagination.setPage(1); PagedResult sheets = userResources.listOrgSheets(pagination, null); + assertThat(sheets.getData()).isNotNull().isNotEmpty(); + assertThat(sheets.getData()).hasSize(1); + assertThat(sheets.getData().get(0).getId()).isEqualTo(2894323533539204L); + assertThat(sheets.getData().get(0).getOwner()).isEqualTo("john.doe@smartsheet.com"); + } + + @Test + void testListAlternateEmails() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/listAlternateEmails.json")); + + PaginationParameters pagination = new PaginationParameters(); + pagination.setIncludeAll(true); + pagination.setPageSize(1); + pagination.setPage(1); + + PagedResult alternateEmailPagedResult = userResources.listAlternateEmails(1234L, pagination); + assertThat(alternateEmailPagedResult.getData()).isNotNull().isNotEmpty(); + assertThat(alternateEmailPagedResult.getData()).hasSize(2); + assertThat(alternateEmailPagedResult.getData().get(0).getId()).isEqualTo(2894323533539204L); + assertThat(alternateEmailPagedResult.getData().get(0).getEmail()).isEqualTo("john.doe@smartsheet.com"); + // since this is a Boolean, this is null if not set + assertThat(alternateEmailPagedResult.getData().get(0).getConfirmed()).isNull(); + + assertThat(alternateEmailPagedResult.getData().get(1).getId()).isEqualTo(787878L); + assertThat(alternateEmailPagedResult.getData().get(1).getEmail()).isEqualTo("jane.doe@smartsheet.com"); + assertThat(alternateEmailPagedResult.getData().get(1).getConfirmed()).isFalse(); + } + + @Test + void testGetAlternateEmail() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/getAlternateEmail.json")); + + PaginationParameters pagination = new PaginationParameters(); + pagination.setIncludeAll(true); + pagination.setPageSize(1); + pagination.setPage(1); + + AlternateEmail alternateEmail = userResources.getAlternateEmail(1234L, 7845112L); + assertThat(alternateEmail).isNotNull(); + assertThat(alternateEmail.getId()).isEqualTo(2894323533539204L); + assertThat(alternateEmail.getEmail()).isEqualTo("john.doe@smartsheet.com"); + // since this is a Boolean, this is null if not set + assertThat(alternateEmail.getConfirmed()).isNull(); + } + + @Test + void testAddAlternateEmail() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/addAlternateEmail.json")); + + PaginationParameters pagination = new PaginationParameters(); + pagination.setIncludeAll(true); + pagination.setPageSize(1); + pagination.setPage(1); + + AlternateEmail alternateEmail = new AlternateEmail(); + alternateEmail.setEmail("foo.bar@smartsheet.com"); + + List alternateEmailList = Lists.newArrayList(alternateEmail); + + List alternateEmails = userResources.addAlternateEmail(1234L, alternateEmailList); + assertThat(alternateEmails).isNotNull(); + assertThat(alternateEmails).hasSize(2); + } + + @Test + void testAddAlternateEmail_AlternateEmailNull() throws IOException { + server.setResponseBody(new File("src/test/resources/addAlternateEmail.json")); + + PaginationParameters pagination = new PaginationParameters(); + pagination.setIncludeAll(true); + pagination.setPageSize(1); + pagination.setPage(1); + + assertThatThrownBy(() -> userResources.addAlternateEmail(1234L, null)).isInstanceOf(IllegalArgumentException.class); + } + + @Test + void testAddAlternateEmail_NoEmailSupplied() throws SmartsheetException, IOException { + server.setResponseBody(new File("src/test/resources/addAlternateEmail.json")); + + PaginationParameters pagination = new PaginationParameters(); + pagination.setIncludeAll(true); + pagination.setPageSize(1); + pagination.setPage(1); + + List alternateEmailList = Lists.newArrayList(); + + List alternateEmails = userResources.addAlternateEmail(1234L, alternateEmailList); + assertThat(alternateEmails).isNotNull(); + assertThat(alternateEmails).hasSize(0); + } + + @Test + void testDeleteAlternateEmail() throws IOException { + server.setResponseBody(new File("src/test/resources/deleteUser.json")); + assertThatCode(() -> userResources.deleteAlternateEmail(1234L, 7878L)).doesNotThrowAnyException(); + } + + @Disabled("Not working with return type") + @Test + void testPromoteAlternateEmail() throws IOException, SmartsheetException { + server.setResponseBody(new File("src/test/resources/promoteAlternateEmail.json")); + + PaginationParameters pagination = new PaginationParameters(); + pagination.setIncludeAll(true); + pagination.setPageSize(1); + pagination.setPage(1); + + AlternateEmail alternateEmail = userResources.promoteAlternateEmail(1234L, 7878L); + assertThat(alternateEmail).isNotNull(); + } + + @Test + void testAddProfileImage_ImageNull() { + assertThatThrownBy(() -> { + userResources.addProfileImage(1234L, null, "application/octet-stream"); + }).isInstanceOf(IllegalArgumentException.class); } } diff --git a/src/test/resources/addAlternateEmail.json b/src/test/resources/addAlternateEmail.json new file mode 100644 index 00000000..fd5db2fd --- /dev/null +++ b/src/test/resources/addAlternateEmail.json @@ -0,0 +1,16 @@ +{ + "resultCode": 0, + "message": "SUCCESS", + "result": [ + { + "id": 2894323533539204, + "email": "john.doe@smartsheet.com" + }, + { + "id": 78789, + "email": "foo.bar@smartsheet.com" + } + ] +} + + diff --git a/src/test/resources/getAlternateEmail.json b/src/test/resources/getAlternateEmail.json new file mode 100644 index 00000000..31023aa4 --- /dev/null +++ b/src/test/resources/getAlternateEmail.json @@ -0,0 +1,4 @@ +{ + "id": 2894323533539204, + "email": "john.doe@smartsheet.com" +} \ No newline at end of file diff --git a/src/test/resources/getCurrentUserIncludesGroups.json b/src/test/resources/getCurrentUserIncludesGroups.json new file mode 100644 index 00000000..81e0946d --- /dev/null +++ b/src/test/resources/getCurrentUserIncludesGroups.json @@ -0,0 +1,23 @@ +{ + "id": 2222222222, + "email": "test@smartsheet.com", + "firstName": "John", + "lastName": "Doe", + "locale": "en_US", + "timeZone": "US/Pacific", + "account": { + "name": "Smartsheet", + "id": 111111111111 + }, + "groups": [ + { + "id": 456456, + "name": "Group 1", + "description": "My group", + "owner": "jane.doe@smartsheet.com", + "ownerId": 789789, + "createdAt": "2019-08-24T14:15:22Z", + "modifiedAt": "2019-08-24T14:15:22Z" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/getSight.json b/src/test/resources/getSight.json new file mode 100644 index 00000000..cd287831 --- /dev/null +++ b/src/test/resources/getSight.json @@ -0,0 +1,19 @@ +{ + "columnCount": 7845, + "widgets": [], + "favorite": false, + "accessLevel": "VIEWER", + "permalink": "https://foo.bar.url", + "createdAt": "2014-01-06T16:25:57Z", + "modifiedAt": "2014-01-06T16:25:57Z", + "workspace": { + "id": 2349499415848836, + "name": "New Workspace1", + "accessLevel": "OWNER", + "permalink": "https://app.smartsheet.com/b/home?lx=asdf" + }, + "source": { + "id": 4503604829677444, + "type": "sight" + } +} \ No newline at end of file diff --git a/src/test/resources/getSightPublishStatus.json b/src/test/resources/getSightPublishStatus.json new file mode 100644 index 00000000..30fb156f --- /dev/null +++ b/src/test/resources/getSightPublishStatus.json @@ -0,0 +1,5 @@ +{ + "readOnlyFullEnabled": false, + "readOnlyFullAccessibleBy": false, + "readOnlyFullUrl": "https://foo.bar.com" +} \ No newline at end of file diff --git a/src/test/resources/listAlternateEmails.json b/src/test/resources/listAlternateEmails.json new file mode 100644 index 00000000..295a6ee9 --- /dev/null +++ b/src/test/resources/listAlternateEmails.json @@ -0,0 +1,17 @@ +{ + "pageNumber": 1, + "pageSize": 100, + "totalPages": 1, + "totalCount": 1, + "data": [ + { + "id": 2894323533539204, + "email": "john.doe@smartsheet.com" + }, + { + "id": 787878, + "email": "jane.doe@smartsheet.com", + "confirmed": false + } + ] +} \ No newline at end of file diff --git a/src/test/resources/listSights.json b/src/test/resources/listSights.json new file mode 100644 index 00000000..f7c555bf --- /dev/null +++ b/src/test/resources/listSights.json @@ -0,0 +1,27 @@ +{ + "data": [ + { + "columnCount": 7845, + "widgets": [], + "favorite": false, + "accessLevel": "VIEWER", + "permalink" : "https://foo.bar.url", + "createdAt":"2014-01-06T16:25:57Z", + "modifiedAt":"2014-01-06T16:25:57Z", + "workspace": { + "id":2349499415848836, + "name":"New Workspace1", + "accessLevel":"OWNER", + "permalink":"https://app.smartsheet.com/b/home?lx=asdf" + }, + "source": { + "id": 4503604829677444, + "type": "sight" + } + } + ], + "pageNumber": 1, + "pageSize": 100, + "totalCount": 418, + "totalPages": 5 +} diff --git a/src/test/resources/promoteAlternateEmail.json b/src/test/resources/promoteAlternateEmail.json new file mode 100644 index 00000000..d9a6a2d0 --- /dev/null +++ b/src/test/resources/promoteAlternateEmail.json @@ -0,0 +1,9 @@ +{ + "resultCode": 0, + "message": "SUCCESS", + "result": + { + "id": 2894323533539204, + "email": "john.doe@smartsheet.com" + } +} diff --git a/src/test/resources/setSightPublishStatus.json b/src/test/resources/setSightPublishStatus.json new file mode 100644 index 00000000..d3970afe --- /dev/null +++ b/src/test/resources/setSightPublishStatus.json @@ -0,0 +1,10 @@ +{ + "resultCode": 0, + "message": "SUCCESS", + "result": + { + "readOnlyFullEnabled": false, + "readOnlyFullAccessibleBy": false, + "readOnlyFullUrl": "https://foo.bar.com" + } +} \ No newline at end of file diff --git a/src/test/resources/updateSight.json b/src/test/resources/updateSight.json new file mode 100644 index 00000000..01a620a0 --- /dev/null +++ b/src/test/resources/updateSight.json @@ -0,0 +1,24 @@ +{ + "resultCode": 0, + "message": "SUCCESS", + "result": + { + "columnCount": 7845, + "widgets": [], + "favorite": false, + "accessLevel": "VIEWER", + "permalink": "https://foo.bar.url", + "createdAt": "2014-01-06T16:25:57Z", + "modifiedAt": "2014-01-06T16:25:57Z", + "workspace": { + "id": 2349499415848836, + "name": "New Workspace1", + "accessLevel": "OWNER", + "permalink": "https://app.smartsheet.com/b/home?lx=asdf" + }, + "source": { + "id": 4503604829677444, + "type": "sight" + } + } +} \ No newline at end of file