-
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.
fix: properly cast response when uploading a new file version using s…
…ession (#810)
- Loading branch information
Showing
5 changed files
with
110 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,12 +42,11 @@ public async Task UploadNewVersionUsingSessionAsync_ValidResponse() | |
})); | ||
|
||
|
||
var responseString = "{ \"type\": \"file\", \"id\": \"5000948880\", \"sequence_id\": \"3\", \"etag\": \"3\", \"sha1\": \"134b65991ed521fcfe4724b7d814ab8ded5185dc\", \"name\": \"new name.jpg\", \"description\": \"a picture of tigers\", \"size\": 629644, \"path_collection\": { \"total_count\": 2, \"entries\": [ { \"type\": \"folder\", \"id\": \"0\", \"sequence_id\": null, \"etag\": null, \"name\": \"All Files\" }, { \"type\": \"folder\", \"id\": \"11446498\", \"sequence_id\": \"1\", \"etag\": \"1\", \"name\": \"Pictures\" } ] }, \"created_at\": \"2012-12-12T10:55:30-08:00\", \"modified_at\": \"2012-12-12T11:04:26-08:00\", \"created_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"[email protected]\" }, \"modified_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"[email protected]\" }, \"owned_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"[email protected]\" }, \"shared_link\": { \"url\": \"https://www.box.com/s/rh935iit6ewrmw0unyul\", \"download_url\": \"https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg\", \"vanity_url\": null, \"is_password_enabled\": false, \"unshared_at\": null, \"download_count\": 0, \"preview_count\": 0, \"access\": \"open\", \"permissions\": { \"can_download\": true, \"can_preview\": true } }, \"parent\": { \"type\": \"folder\", \"id\": \"11446498\", \"sequence_id\": \"1\", \"etag\": \"1\", \"name\": \"Pictures\" }, \"item_status\": \"active\", \"tags\": [ \"important\", \"needs review\" ] }"; | ||
Handler.Setup(h => h.ExecuteAsync<BoxFile>(It.IsAny<IBoxRequest>())) | ||
.Returns(Task.FromResult<IBoxResponse<BoxFile>>(new BoxResponse<BoxFile>() | ||
Handler.Setup(h => h.ExecuteAsync<BoxCollection<BoxFile>>(It.IsAny<IBoxRequest>())) | ||
.Returns(Task.FromResult<IBoxResponse<BoxCollection<BoxFile>>>(new BoxResponse<BoxCollection<BoxFile>>() | ||
{ | ||
Status = ResponseStatus.Success, | ||
ContentString = responseString | ||
ContentString = LoadFixtureFromJson("Fixtures/BoxFiles/UploadNewVersionUsingSession200.json") | ||
})); | ||
|
||
var fakeStream = new Mock<System.IO.Stream>(); | ||
|
81 changes: 81 additions & 0 deletions
81
Box.V2.Test/Fixtures/BoxFiles/UploadNewVersionUsingSession200.json
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"entries": [ | ||
{ | ||
"id": 5000948880, | ||
"etag": 1, | ||
"type": "file", | ||
"sequence_id": 3, | ||
"name": "Contract.pdf", | ||
"sha1": "85136C79CBF9FE36BB9D05D0639C70C265C18D37", | ||
"file_version": { | ||
"id": 12345, | ||
"type": "file_version", | ||
"sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc" | ||
}, | ||
"description": "Contract for Q1 renewal", | ||
"size": 629644, | ||
"path_collection": { | ||
"total_count": 1, | ||
"entries": [ | ||
{ | ||
"id": 12345, | ||
"etag": 1, | ||
"type": "folder", | ||
"sequence_id": 3, | ||
"name": "Contracts" | ||
} | ||
] | ||
}, | ||
"created_at": "2012-12-12T10:53:43-08:00", | ||
"modified_at": "2012-12-12T10:53:43-08:00", | ||
"trashed_at": "2012-12-12T10:53:43-08:00", | ||
"purged_at": "2012-12-12T10:53:43-08:00", | ||
"content_created_at": "2012-12-12T10:53:43-08:00", | ||
"content_modified_at": "2012-12-12T10:53:43-08:00", | ||
"created_by": { | ||
"id": 11446498, | ||
"type": "user", | ||
"name": "Aaron Levie", | ||
"login": "[email protected]" | ||
}, | ||
"modified_by": { | ||
"id": 11446498, | ||
"type": "user", | ||
"name": "Aaron Levie", | ||
"login": "[email protected]" | ||
}, | ||
"owned_by": { | ||
"id": 11446498, | ||
"type": "user", | ||
"name": "Aaron Levie", | ||
"login": "[email protected]" | ||
}, | ||
"shared_link": { | ||
"url": "https://www.box.com/s/vspke7y05sb214wjokpk", | ||
"download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", | ||
"vanity_url": "https://acme.app.box.com/v/my_url/", | ||
"vanity_name": "my_url", | ||
"access": "open", | ||
"effective_access": "company", | ||
"effective_permission": "can_download", | ||
"unshared_at": "2018-04-13T13:53:23-07:00", | ||
"is_password_enabled": true, | ||
"permissions": { | ||
"can_download": true, | ||
"can_preview": true | ||
}, | ||
"download_count": 3, | ||
"preview_count": 3 | ||
}, | ||
"parent": { | ||
"id": 12345, | ||
"etag": 1, | ||
"type": "folder", | ||
"sequence_id": 3, | ||
"name": "Contracts" | ||
}, | ||
"item_status": "active" | ||
} | ||
], | ||
"total_count": 1 | ||
} |
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