-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: remove deprecated methods (#874)
- Loading branch information
Showing
30 changed files
with
187 additions
and
804 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,60 +75,6 @@ public async Task GetFolderItems_ValidResponse_SortDirection() | |
Assert.AreEqual("DESC", boxRequest.Parameters["direction"]); | ||
} | ||
|
||
[TestMethod] | ||
public async Task GetFolder_ValidResponse_ValidFolder() | ||
{ | ||
Handler.Setup(h => h.ExecuteAsync<BoxFolder>(It.IsAny<IBoxRequest>())) | ||
.Returns(() => Task.FromResult<IBoxResponse<BoxFolder>>(new BoxResponse<BoxFolder>() | ||
{ | ||
Status = ResponseStatus.Success, | ||
ContentString = "{ \"type\":\"folder\", \"id\":\"0\", \"sequence_id\":null, \"etag\":null, \"name\":\"All Files\", \"created_at\":null, \"modified_at\":null, \"description\":\"\", \"size\":61591428468, \"path_collection\":{ \"total_count\":0, \"entries\":[ ] }, \"created_by\":{ \"type\":\"user\", \"id\":\"189912110\", \"name\":\"Brian\", \"login\":\"[email protected]\" }, \"modified_by\":{ \"type\":\"user\", \"id\":\"189912110\", \"name\":\"Brian\", \"login\":\"[email protected]\" }, \"trashed_at\":null, \"purged_at\":null, \"content_created_at\":null, \"content_modified_at\":null, \"owned_by\":{ \"type\":\"user\", \"id\":\"189912110\", \"name\":\"Brian\", \"login\":\"[email protected]\" }, \"shared_link\":null, \"folder_upload_email\":null, \"parent\":null, \"item_status\":\"active\", \"item_collection\":{ \"total_count\":10, \"entries\":[ { \"type\":\"folder\", \"id\":\"766352168\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Books\" }, { \"type\":\"folder\", \"id\":\"869883498\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"bytLabs\" }, { \"type\":\"folder\", \"id\":\"767221958\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Games\" }, { \"type\":\"folder\", \"id\":\"766174084\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Mixes\" }, { \"type\":\"folder\", \"id\":\"57181304\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Muzik\" }, { \"type\":\"folder\", \"id\":\"857305570\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"My\" }, { \"type\":\"folder\", \"id\":\"627316229\", \"sequence_id\":\"1\", \"etag\":\"1\", \"name\":\"My Music Folder\" }, { \"type\":\"folder\", \"id\":\"860155462\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"sample\" }, { \"type\":\"folder\", \"id\":\"775829294\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Software\" }, { \"type\":\"folder\", \"id\":\"811565831\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Test\" } ], \"offset\":0, \"limit\":10, \"order\":[ { \"by\":\"type\", \"direction\":\"ASC\" }, { \"by\":\"name\", \"direction\":\"ASC\" } ] } }" | ||
})); | ||
|
||
BoxFolder f = await _foldersManager.GetItemsAsync("0", 10); | ||
|
||
Assert.AreEqual(f.Id, "0"); | ||
Assert.AreEqual(f.Type, "folder"); | ||
Assert.IsNull(f.SequenceId); | ||
Assert.IsNull(f.ETag); | ||
Assert.IsNull(f.CreatedAt); | ||
Assert.IsNull(f.ModifiedAt); | ||
Assert.AreEqual(f.Description, ""); | ||
Assert.AreEqual(f.Size, 61591428468); | ||
Assert.AreEqual(f.PathCollection.TotalCount, 0); | ||
Assert.AreEqual(f.PathCollection.Entries.Count, 0); | ||
Assert.AreEqual(f.CreatedBy.Type, "user"); | ||
Assert.AreEqual(f.CreatedBy.Id, "189912110"); | ||
Assert.AreEqual(f.CreatedBy.Name, "Brian"); | ||
Assert.AreEqual(f.CreatedBy.Login, "[email protected]"); | ||
Assert.AreEqual(f.ModifiedBy.Type, "user"); | ||
Assert.AreEqual(f.ModifiedBy.Id, "189912110"); | ||
Assert.AreEqual(f.ModifiedBy.Name, "Brian"); | ||
Assert.AreEqual(f.ModifiedBy.Login, "[email protected]"); | ||
//Assert.IsNull(f.TrashedAt); // Need to add property | ||
//Assert.IsNull(f.PurgedAt); // Need to add property | ||
//Assert.IsNull(f.ContentCreatedAt); // Need to add property | ||
//Assert.IsNull(f.ContentModifiedAt); // Need to add property | ||
Assert.AreEqual(f.OwnedBy.Type, "user"); | ||
Assert.AreEqual(f.OwnedBy.Id, "189912110"); | ||
Assert.AreEqual(f.OwnedBy.Name, "Brian"); | ||
Assert.AreEqual(f.OwnedBy.Login, "[email protected]"); | ||
Assert.IsNull(f.SharedLink); | ||
Assert.IsNull(f.FolderUploadEmail); | ||
Assert.IsNull(f.Parent); | ||
Assert.AreEqual(f.ItemStatus, "active"); | ||
Assert.AreEqual(f.Id, "0"); | ||
Assert.AreEqual(f.Name, "All Files"); | ||
Assert.AreEqual(f.ModifiedBy.Id, "189912110"); | ||
Assert.AreEqual(f.ItemCollection.TotalCount, 10); | ||
Assert.AreEqual(f.ItemCollection.Entries.Count, 10); | ||
//Assert.AreEqual(f.Offset, "0"); // Need to add property | ||
//Assert.AreEqual(f.Order[0].By, "type"); // Need to add property | ||
//Assert.AreEqual(f.Order[0].Direction, "ASC"); // Need to add property | ||
//Assert.AreEqual(f.Order[1].By, "name"); // Need to add property | ||
//Assert.AreEqual(f.Order[1].Direction, "ASC"); // Need to add property | ||
} | ||
|
||
[TestMethod] | ||
public async Task CreateFolder_ValidResponse_ValidFolder() | ||
{ | ||
|
@@ -707,7 +653,7 @@ public async Task GetTrashedItems_ValidResponse_ValidFiles() | |
})); | ||
|
||
/*** Act ***/ | ||
BoxCollection<BoxItem> i = await _foldersManager.GetTrashItemsAsync("fakeId", 10); | ||
BoxCollection<BoxItem> i = await _foldersManager.GetTrashItemsAsync(10); | ||
BoxItem i1 = i.Entries.FirstOrDefault(); | ||
BoxItem i2 = i.Entries.Skip(1).FirstOrDefault(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -554,65 +554,6 @@ public async Task SetFolderMetadataAsync_Create_Error() | |
} | ||
} | ||
|
||
[TestMethod] | ||
public async Task ExecuteMetadataQuery_ValidResponse() | ||
{ | ||
/*** Arrange ***/ | ||
IBoxRequest boxRequest = null; | ||
Handler.Setup(h => h.ExecuteAsync<BoxCollectionMarkerBased<BoxMetadataQueryItem>>(It.IsAny<IBoxRequest>())) | ||
.Returns(Task.FromResult<IBoxResponse<BoxCollectionMarkerBased<BoxMetadataQueryItem>>>(new BoxResponse<BoxCollectionMarkerBased<BoxMetadataQueryItem>>() | ||
{ | ||
Status = ResponseStatus.Success, | ||
ContentString = LoadFixtureFromJson("Fixtures/BoxMetadata/ExecuteMetadataQuery200.json") | ||
})) | ||
.Callback<IBoxRequest>(r => boxRequest = r); | ||
|
||
/*** Act ***/ | ||
var queryParams = new Dictionary<string, object> | ||
{ | ||
{ "arg", 100 } | ||
}; | ||
var orderByList = new List<BoxMetadataQueryOrderBy>(); | ||
var orderBy = new BoxMetadataQueryOrderBy() | ||
{ | ||
FieldKey = "amount", | ||
Direction = BoxSortDirection.ASC | ||
}; | ||
orderByList.Add(orderBy); | ||
var marker = "q3f87oqf3qygou5t478g9gwrbul"; | ||
BoxCollectionMarkerBased<BoxMetadataQueryItem> items = await _metadataManager.ExecuteMetadataQueryAsync(from: "enterprise_123456.someTemplate", query: "amount >= :arg", queryParameters: queryParams, ancestorFolderId: "5555", indexName: "amountAsc", orderBy: orderByList, marker: marker, autoPaginate: false); | ||
/*** Assert ***/ | ||
|
||
// Request check | ||
Assert.IsNotNull(boxRequest); | ||
Assert.AreEqual(RequestMethod.Post, boxRequest.Method); | ||
Assert.AreEqual(MetadataQueryUri, boxRequest.AbsoluteUri.AbsoluteUri); | ||
var payload = JObject.Parse(boxRequest.Payload); | ||
Assert.AreEqual("enterprise_123456.someTemplate", payload["from"]); | ||
Assert.AreEqual("amount >= :arg", payload["query"]); | ||
Assert.AreEqual(100, payload["query_params"]["arg"]); | ||
Assert.AreEqual("5555", payload["ancestor_folder_id"]); | ||
var payloadOrderBy = JArray.Parse(payload["order_by"].ToString()); | ||
Assert.AreEqual("amount", payloadOrderBy[0]["field_key"]); | ||
Assert.AreEqual("ASC", payloadOrderBy[0]["direction"]); | ||
Assert.AreEqual(marker, payload["marker"]); | ||
|
||
// Response check | ||
Assert.AreEqual(items.Entries[0].Item.Type, "file"); | ||
Assert.AreEqual(items.Entries[0].Item.Id, "1617554169109"); | ||
Assert.AreEqual(items.Entries[0].Item.Name, "My Contract.docx"); | ||
Assert.AreEqual(items.Entries[0].Item.SequenceId, "0"); | ||
Assert.AreEqual(items.Entries[0].Item.CreatedBy.Type, "user"); | ||
Assert.AreEqual(items.Entries[0].Item.CreatedBy.Login, "[email protected]"); | ||
Assert.AreEqual(items.Entries[0].Item.Parent.Id, "16125613433"); | ||
Assert.AreEqual(items.NextMarker, "AAAAAmVYB1FWec8GH6yWu2nwmanfMh07IyYInaa7DZDYjgO1H4KoLW29vPlLY173OKsci6h6xGh61gG73gnaxoS+o0BbI1/h6le6cikjlupVhASwJ2Cj0tOD9wlnrUMHHw3/ISf+uuACzrOMhN6d5fYrbidPzS6MdhJOejuYlvsg4tcBYzjauP3+VU51p77HFAIuObnJT0ff"); | ||
var metadata = JObject.FromObject(items.Entries[0].Metadata["enterprise_123456"]); | ||
Assert.AreEqual(metadata["someTemplate"]["$parent"], "file_161753469109"); | ||
Assert.AreEqual(metadata["someTemplate"]["customerName"], "Phoenix Corp"); | ||
Assert.AreEqual(metadata["someTemplate"]["$typeVersion"], 0); | ||
Assert.AreEqual(metadata["someTemplate"]["region"], "West"); | ||
} | ||
|
||
[TestMethod] | ||
public async Task ExecuteMetadataQueryWithoutUseIndexWithFields_ValidResponse() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,62 +33,14 @@ public async Task SearchKeyword_ValidResponse_ValidResults() | |
.Callback<IBoxRequest>(r => boxRequest = r); | ||
|
||
/*** Act ***/ | ||
BoxCollection<BoxItem> results = await SearchManager.SearchAsync("fakeKeyword", 10, sort: "modified_at", direction: BoxSortDirection.ASC); | ||
BoxCollection<BoxItem> results = await SearchManager.QueryAsync("fakeKeyword", limit: 10, sort: "modified_at", direction: BoxSortDirection.ASC); | ||
var queryParams = boxRequest.Parameters; | ||
/*** Assert ***/ | ||
Assert.AreEqual(4, results.TotalCount); | ||
Assert.AreEqual("modified_at", queryParams["sort"]); | ||
Assert.AreEqual("ASC", queryParams["direction"]); | ||
} | ||
|
||
[TestMethod] | ||
public async Task SearchWithDateRanges_ValidResponse_ValidResults() | ||
{ | ||
/*** Arrange ***/ | ||
var responseString = "{\"total_count\":4,\"entries\":[{\"type\":\"file\",\"id\":\"1874102965\",\"sequence_id\":\"0\",\"etag\":\"0\",\"sha1\":\"63a112a4567fb556f5269735102a2f24f2cbea56\",\"name\":\"football.jpg\",\"description\":\"\",\"size\":260271,\"path_collection\":{\"total_count\":1,\"entries\":[{\"type\":\"folder\",\"id\":\"0\",\"sequence_id\":null,\"etag\":null,\"name\":\"All Files\"}]},\"created_at\":\"2012-03-22T18:25:07-07:00\",\"modified_at\":\"2012-10-25T14:40:05-07:00\",\"created_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"[email protected]\"},\"modified_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"[email protected]\"},\"owned_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"[email protected]\"},\"shared_link\":null,\"parent\":{\"type\":\"folder\",\"id\":\"0\",\"sequence_id\":null,\"etag\":null,\"name\":\"All Files\"},\"item_status\":\"active\", \"sort\":\"modified_at\", \"direction\":\"ASC\"}],\"offset\":0,\"limit\":1}"; | ||
IBoxRequest boxRequest = null; | ||
|
||
Handler.Setup(h => h.ExecuteAsync<BoxCollection<BoxItem>>(It.IsAny<IBoxRequest>())) | ||
.Returns(Task.FromResult<IBoxResponse<BoxCollection<BoxItem>>>(new BoxResponse<BoxCollection<BoxItem>>() | ||
{ | ||
Status = ResponseStatus.Success, | ||
ContentString = responseString | ||
})) | ||
.Callback<IBoxRequest>(r => boxRequest = r); | ||
|
||
/*** Act ***/ | ||
var startDate = new DateTimeOffset(1988, 11, 18, 9, 30, 0, TimeSpan.Zero); | ||
var endDate = new DateTimeOffset(2018, 11, 18, 9, 30, 0, TimeSpan.Zero); | ||
var results = await SearchManager.SearchAsync("test", createdAtRangeFromDate: startDate, createdAtRangeToDate: endDate, updatedAtRangeFromDate: startDate, updatedAtRangeToDate: endDate); | ||
|
||
/*** Assert ***/ | ||
Assert.AreEqual("query=test&created_at_range=1988-11-18T09%3A30%3A00%2B00%3A00%2C2018-11-18T09%3A30%3A00%2B00%3A00&updated_at_range=1988-11-18T09%3A30%3A00%2B00%3A00%2C2018-11-18T09%3A30%3A00%2B00%3A00&limit=30&offset=0", boxRequest.GetQueryString()); | ||
} | ||
|
||
[TestMethod] | ||
public async Task SearchWithOpenDateRanges_ValidResponse_ValidResults() | ||
{ | ||
/*** Arrange ***/ | ||
var responseString = "{\"total_count\":4,\"entries\":[{\"type\":\"file\",\"id\":\"1874102965\",\"sequence_id\":\"0\",\"etag\":\"0\",\"sha1\":\"63a112a4567fb556f5269735102a2f24f2cbea56\",\"name\":\"football.jpg\",\"description\":\"\",\"size\":260271,\"path_collection\":{\"total_count\":1,\"entries\":[{\"type\":\"folder\",\"id\":\"0\",\"sequence_id\":null,\"etag\":null,\"name\":\"All Files\"}]},\"created_at\":\"2012-03-22T18:25:07-07:00\",\"modified_at\":\"2012-10-25T14:40:05-07:00\",\"created_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"[email protected]\"},\"modified_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"[email protected]\"},\"owned_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"[email protected]\"},\"shared_link\":null,\"parent\":{\"type\":\"folder\",\"id\":\"0\",\"sequence_id\":null,\"etag\":null,\"name\":\"All Files\"},\"item_status\":\"active\", \"sort\":\"modified_at\", \"direction\":\"ASC\"}],\"offset\":0,\"limit\":1}"; | ||
IBoxRequest boxRequest = null; | ||
|
||
Handler.Setup(h => h.ExecuteAsync<BoxCollection<BoxItem>>(It.IsAny<IBoxRequest>())) | ||
.Returns(Task.FromResult<IBoxResponse<BoxCollection<BoxItem>>>(new BoxResponse<BoxCollection<BoxItem>>() | ||
{ | ||
Status = ResponseStatus.Success, | ||
ContentString = responseString | ||
})) | ||
.Callback<IBoxRequest>(r => boxRequest = r); | ||
|
||
/*** Act ***/ | ||
var startDate = new DateTimeOffset(1988, 11, 18, 9, 30, 0, TimeSpan.Zero); | ||
var endDate = new DateTimeOffset(2018, 11, 18, 9, 30, 0, TimeSpan.Zero); | ||
var results = await SearchManager.SearchAsync("test", createdAtRangeFromDate: startDate, updatedAtRangeToDate: endDate); | ||
|
||
/*** Assert ***/ | ||
Assert.AreEqual("query=test&created_at_range=1988-11-18T09%3A30%3A00%2B00%3A00%2C&updated_at_range=%2C2018-11-18T09%3A30%3A00%2B00%3A00&limit=30&offset=0", boxRequest.GetQueryString()); | ||
} | ||
|
||
[TestMethod] | ||
public async Task Query_ValidResponse_ValidResults() | ||
{ | ||
|
Oops, something went wrong.