Skip to content

Commit

Permalink
Release 4.9.3 (#90)
Browse files Browse the repository at this point in the history
* Fix API tests to nest under a folder instead of acting at the root
  - Doing this enables using user accounts that don't have an empty root
* Update to new routes
  • Loading branch information
joshzana authored Dec 17, 2018
1 parent a158f2d commit 8abced6
Show file tree
Hide file tree
Showing 58 changed files with 6,141 additions and 305 deletions.
36 changes: 28 additions & 8 deletions buildall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,41 @@ $nugetPath = "$nugetDir\nuget.exe"
$nugetSpecPath = "$sourceDir\Dropbox.Api.nuspec"
$docBuildPath = Resolve-Path "doc\StoneDocs.shfbproj"
$majorVersion = "4.0"
$releaseVersion = "4.9.2"
$releaseVersion = "4.9.3"
$assemblyInfoPath = "$sourceDir\AppProperties\AssemblyInfo.cs"
$signKeyPath = "$sourceDir\dropbox_api_key.snk"
$releaseNotes = @'
What's New:
- Files Namespace:
- Updated doc strings
- Team_log Namespace:
- Updated event docstrings
- New reset field for loading events with a cursor
- Common Namespace:
- Force matching dot character in alias EmailAddress
- Allow DisplayNameLegacy to support a name of zero chars
- Contacts namespace:
- New namespace
- New routes: delete_manual_contacts and delete_manual_contacts_batch
- New argument structs for new routes
- File_properties namespace:
- Doesn't allow app folder app to access file property endpoints.
- Files namespace:
- Create copy_batch:2 and move_batch:2 endpoints. Deprecate existing copy_batch and move_batch.
- Sharing namespace:
- Add no_one option to LinkAudience union
- Sharing_files namespace:
- Doesn't allow app folder app to access sharing files endpoints.
- Teams namespace:
- Only Team apps with Team member file access can access team/properties endpoints.
- Add is_disconnected boolean to RemovedStatus struct
- Add error response type to namespace/list route
- Team_log namespace:
- New event types added
- Team_policies Namespace:
- New CameraUploadsPolicyState union
'@

$builds = @(
Expand Down
69 changes: 39 additions & 30 deletions dropbox-sdk-dotnet/Dropbox.Api.Tests/DropboxApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Dropbox.Api.Tests
using Dropbox.Api.Auth;
using Dropbox.Api.Common;
using Dropbox.Api.Users;
using Dropbox.Api.Files;

/// <summary>
/// The test class for Dropbox API.
Expand Down Expand Up @@ -47,6 +48,7 @@ public class DropboxApiTests
/// </summary>
public static DropboxAppClient AppClient;

private readonly static string TestingPath = "/Testing/Dropbox.Api.Tests";

[ClassInitialize]
public static void Initialize(TestContext context)
Expand All @@ -64,20 +66,28 @@ public static void Initialize(TestContext context)
}

[TestInitialize]
public void Initialize()
public async void Initialize()
{
var result = Client.Files.ListFolderAsync("").Result;
Assert.AreEqual(result.Entries.Count, 0);
try
{
var result = await Client.Files.ListFolderAsync(TestingPath);
Assert.AreEqual(0, result.Entries.Count);
} catch (ApiException<ListFolderError>)
{
// create folder if it doesn't exist
var result = Client.Files.CreateFolderV2Async(TestingPath).Result;
Assert.AreEqual(TestingPath, result.Metadata.PathDisplay);
}
}


[TestCleanup]
public void Cleanup()
{
var result = Client.Files.ListFolderAsync("").Result;
var result = Client.Files.ListFolderAsync(TestingPath).Result;

foreach (var entry in result.Entries) {
Client.Files.DeleteAsync(entry.PathLower).Wait();
Client.Files.DeleteV2Async(entry.PathLower).Wait();
}
}

Expand All @@ -88,11 +98,11 @@ public void Cleanup()
[TestMethod]
public async Task TestGetMetadata()
{
await Client.Files.UploadAsync("/Foo.txt", body: GetStream("abc"));
var metadata = await Client.Files.GetMetadataAsync("/Foo.txt");
await Client.Files.UploadAsync(TestingPath + "/Foo.txt", body: GetStream("abc"));
var metadata = await Client.Files.GetMetadataAsync(TestingPath + "/Foo.txt");
Assert.AreEqual("Foo.txt", metadata.Name);
Assert.AreEqual("/foo.txt", metadata.PathLower);
Assert.AreEqual("/Foo.txt", metadata.PathDisplay);
Assert.AreEqual(TestingPath.ToLower() + "/foo.txt", metadata.PathLower);
Assert.AreEqual(TestingPath + "/Foo.txt", metadata.PathDisplay);
Assert.IsTrue(metadata.IsFile);

var file = metadata.AsFile;
Expand All @@ -106,17 +116,17 @@ public async Task TestGetMetadata()
[TestMethod]
public async Task TestListFolder()
{
var files = new HashSet<string> { "/a.txt", "/b.txt", "/c.txt" };
var files = new HashSet<string> { "a.txt", "b.txt", "c.txt" };
foreach (var file in files)
{
await Client.Files.UploadAsync(file, body: GetStream("abc"));
await Client.Files.UploadAsync(TestingPath + "/" + file, body: GetStream("abc"));
}

var response = await Client.Files.ListFolderAsync("");
var response = await Client.Files.ListFolderAsync(TestingPath);
Assert.AreEqual(files.Count, response.Entries.Count);
foreach (var entry in response.Entries)
{
Assert.IsTrue(files.Contains(entry.PathLower));
Assert.IsTrue(files.Contains(entry.Name));
Assert.IsTrue(entry.IsFile);
var file = entry.AsFile;
Assert.AreEqual(3, (int)file.Size);
Expand All @@ -130,11 +140,11 @@ public async Task TestListFolder()
[TestMethod]
public async Task TestUpload()
{
var response = await Client.Files.UploadAsync("/Foo.txt", body: GetStream("abc"));
var response = await Client.Files.UploadAsync(TestingPath + "/Foo.txt", body: GetStream("abc"));
Assert.AreEqual(response.Name, "Foo.txt");
Assert.AreEqual(response.PathLower, "/foo.txt");
Assert.AreEqual(response.PathDisplay, "/Foo.txt");
var downloadResponse = await Client.Files.DownloadAsync("/Foo.txt");
Assert.AreEqual(response.PathLower, TestingPath.ToLower() + "/foo.txt");
Assert.AreEqual(response.PathDisplay, TestingPath + "/Foo.txt");
var downloadResponse = await Client.Files.DownloadAsync(TestingPath + "/Foo.txt");
var content = await downloadResponse.GetContentAsStringAsync();
Assert.AreEqual("abc", content);
}
Expand Down Expand Up @@ -168,8 +178,8 @@ public async Task TestUploadRetry()
UserAccessToken,
new DropboxClientConfig { HttpClient = mockClient, MaxRetriesOnError = 10 });

var response = await client.Files.UploadAsync("/Foo.txt", body: GetStream("abc"));
var downloadResponse = await Client.Files.DownloadAsync("/Foo.txt");
var response = await client.Files.UploadAsync(TestingPath + "/Foo.txt", body: GetStream("abc"));
var downloadResponse = await Client.Files.DownloadAsync(TestingPath + "/Foo.txt");
var content = await downloadResponse.GetContentAsStringAsync();
Assert.AreEqual("abc", content);
}
Expand All @@ -182,14 +192,14 @@ public async Task TestUploadRetry()
[TestMethod]
public async Task TestDownload()
{
await Client.Files.UploadAsync("/Foo.txt", body: GetStream("abc"));
var downloadResponse = await Client.Files.DownloadAsync("/Foo.txt");
await Client.Files.UploadAsync(TestingPath + "/Foo.txt", body: GetStream("abc"));
var downloadResponse = await Client.Files.DownloadAsync(TestingPath + "/Foo.txt");
var content = await downloadResponse.GetContentAsStringAsync();
Assert.AreEqual("abc", content);
var response = downloadResponse.Response;
Assert.AreEqual(response.Name, "Foo.txt");
Assert.AreEqual(response.PathLower, "/foo.txt");
Assert.AreEqual(response.PathDisplay, "/Foo.txt");
Assert.AreEqual(response.PathLower, TestingPath.ToLower() + "/foo.txt");
Assert.AreEqual(response.PathDisplay, TestingPath + "/Foo.txt");
}

/// Test rate limit error handling.
Expand All @@ -211,7 +221,7 @@ public async Task TestRateLimit()
var client = new DropboxClient("dummy", new DropboxClientConfig { HttpClient = mockClient });
try
{
await client.Files.GetMetadataAsync("/a.txt");
await client.Files.GetMetadataAsync(TestingPath + "/a.txt");
}
catch (RateLimitException ex)
{
Expand Down Expand Up @@ -294,19 +304,18 @@ public async Task TestTeamAuthSelectAdmin()
[TestMethod]
public async Task TestPathRoot()
{
await Client.Files.UploadAsync("/Foo.txt", body: GetStream("abc"));
await Client.Files.UploadAsync(TestingPath + "/Foo.txt", body: GetStream("abc"));

var pathRootClient = Client.WithPathRoot(PathRoot.Home.Instance);
var metadata = await pathRootClient.Files.GetMetadataAsync("/Foo.txt");
Assert.AreEqual("/foo.txt", metadata.PathLower);

var metadata = await pathRootClient.Files.GetMetadataAsync(TestingPath + "/Foo.txt");
Assert.AreEqual(TestingPath.ToLower() + "/foo.txt", metadata.PathLower);
pathRootClient = Client.WithPathRoot(new PathRoot.Root("123"));

var exceptionRaised = false;

try
{
await pathRootClient.Files.GetMetadataAsync("/Foo.txt");
await pathRootClient.Files.GetMetadataAsync(TestingPath + "/Foo.txt");
}
catch (PathRootException e)
{
Expand Down Expand Up @@ -344,7 +353,7 @@ public async Task TestNoAuth()
var cursor = result.Cursor;

var task = Client.Files.ListFolderLongpollAsync(cursor);
await Client.Files.UploadAsync("/foo.txt", body: GetStream("abc"));
await Client.Files.UploadAsync(TestingPath + "/foo.txt", body: GetStream("abc"));
var response = await task;
Assert.IsTrue(response.Changes);
}
Expand Down
25 changes: 22 additions & 3 deletions dropbox-sdk-dotnet/Dropbox.Api.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
# Visual Studio 15
VisualStudioVersion = 15.0.28307.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleBlogDemo", "Examples\SimpleBlogDemo\SimpleBlogDemo.csproj", "{8772EB1E-3019-4FB3-9059-67681693E873}"
EndProject
Expand All @@ -27,8 +27,8 @@ EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Examples\UniversalDemo\UniversalDemo\UniversalDemo.Shared\UniversalDemo.Shared.projitems*{51d9899c-31d6-4c22-b894-e9498cb90577}*SharedItemsImports = 4
Examples\UniversalDemo\UniversalDemo\UniversalDemo.Shared\UniversalDemo.Shared.projitems*{6bcc4215-b726-4b37-a932-4dca74a1d465}*SharedItemsImports = 13
Examples\UniversalDemo\UniversalDemo\UniversalDemo.Shared\UniversalDemo.Shared.projitems*{680e8f6f-aa67-4912-ae20-f89e482dc2cd}*SharedItemsImports = 4
Examples\UniversalDemo\UniversalDemo\UniversalDemo.Shared\UniversalDemo.Shared.projitems*{6bcc4215-b726-4b37-a932-4dca74a1d465}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -135,6 +135,22 @@ Global
{68180B54-4724-4CD1-BAA6-EE7BC309797C}.Release|ARM.ActiveCfg = Release|Any CPU
{68180B54-4724-4CD1-BAA6-EE7BC309797C}.Release|x64.ActiveCfg = Release|Any CPU
{68180B54-4724-4CD1-BAA6-EE7BC309797C}.Release|x86.ActiveCfg = Release|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Debug|ARM.Build.0 = Debug|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Debug|x64.ActiveCfg = Debug|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Debug|x64.Build.0 = Debug|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Debug|x86.ActiveCfg = Debug|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Debug|x86.Build.0 = Debug|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Release|Any CPU.Build.0 = Release|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Release|ARM.ActiveCfg = Release|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Release|ARM.Build.0 = Release|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Release|x64.ActiveCfg = Release|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Release|x64.Build.0 = Release|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Release|x86.ActiveCfg = Release|Any CPU
{B562AEC0-DAF8-457C-B5ED-AF03B133F168}.Release|x86.Build.0 = Release|Any CPU
{B762DE35-E606-4B57-8860-1A662DF5624C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B762DE35-E606-4B57-8860-1A662DF5624C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B762DE35-E606-4B57-8860-1A662DF5624C}.Debug|ARM.ActiveCfg = Debug|Any CPU
Expand All @@ -159,4 +175,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B3C08646-2DF0-404C-9A72-D460143D9639}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.0.6885")]
[assembly: AssemblyFileVersion("4.0.6925")]

#if DEBUG
[assembly: InternalsVisibleTo("Dropbox.Api.Tests")]
Expand Down
18 changes: 18 additions & 0 deletions dropbox-sdk-dotnet/Dropbox.Api/Dropbox.Api.Doc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
<Compile Include="Generated\Common\RootInfo.cs" />
<Compile Include="Generated\Common\TeamRootInfo.cs" />
<Compile Include="Generated\Common\UserRootInfo.cs" />
<Compile Include="Generated\Contacts\ContactsUserRoutes.cs" />
<Compile Include="Generated\Contacts\DeleteManualContactsArg.cs" />
<Compile Include="Generated\Contacts\DeleteManualContactsError.cs" />
<Compile Include="Generated\DropboxAppClient.cs" />
<Compile Include="Generated\DropboxClient.cs" />
<Compile Include="Generated\DropboxTeamClient.cs" />
Expand Down Expand Up @@ -231,16 +234,23 @@
<Compile Include="Generated\Files\MediaInfo.cs" />
<Compile Include="Generated\Files\MediaMetadata.cs" />
<Compile Include="Generated\Files\Metadata.cs" />
<Compile Include="Generated\Files\MoveBatchArg.cs" />
<Compile Include="Generated\Files\PhotoMetadata.cs" />
<Compile Include="Generated\Files\PreviewArg.cs" />
<Compile Include="Generated\Files\PreviewError.cs" />
<Compile Include="Generated\Files\RelocationArg.cs" />
<Compile Include="Generated\Files\RelocationBatchArg.cs" />
<Compile Include="Generated\Files\RelocationBatchArgBase.cs" />
<Compile Include="Generated\Files\RelocationBatchError.cs" />
<Compile Include="Generated\Files\RelocationBatchErrorEntry.cs" />
<Compile Include="Generated\Files\RelocationBatchJobStatus.cs" />
<Compile Include="Generated\Files\RelocationBatchLaunch.cs" />
<Compile Include="Generated\Files\RelocationBatchResult.cs" />
<Compile Include="Generated\Files\RelocationBatchResultData.cs" />
<Compile Include="Generated\Files\RelocationBatchResultEntry.cs" />
<Compile Include="Generated\Files\RelocationBatchV2JobStatus.cs" />
<Compile Include="Generated\Files\RelocationBatchV2Launch.cs" />
<Compile Include="Generated\Files\RelocationBatchV2Result.cs" />
<Compile Include="Generated\Files\RelocationError.cs" />
<Compile Include="Generated\Files\RelocationPath.cs" />
<Compile Include="Generated\Files\RelocationResult.cs" />
Expand Down Expand Up @@ -676,6 +686,7 @@
<Compile Include="Generated\Team\TeamNamespacesListArg.cs" />
<Compile Include="Generated\Team\TeamNamespacesListContinueArg.cs" />
<Compile Include="Generated\Team\TeamNamespacesListContinueError.cs" />
<Compile Include="Generated\Team\TeamNamespacesListError.cs" />
<Compile Include="Generated\Team\TeamNamespacesListResult.cs" />
<Compile Include="Generated\Team\TeamTeamRoutes.cs" />
<Compile Include="Generated\Team\TokenGetAuthenticatedAdminError.cs" />
Expand Down Expand Up @@ -722,6 +733,9 @@
<Compile Include="Generated\TeamLog\AppUnlinkUserDetails.cs" />
<Compile Include="Generated\TeamLog\AppUnlinkUserType.cs" />
<Compile Include="Generated\TeamLog\AssetLogInfo.cs" />
<Compile Include="Generated\TeamLog\CameraUploadsPolicy.cs" />
<Compile Include="Generated\TeamLog\CameraUploadsPolicyChangedDetails.cs" />
<Compile Include="Generated\TeamLog\CameraUploadsPolicyChangedType.cs" />
<Compile Include="Generated\TeamLog\Certificate.cs" />
<Compile Include="Generated\TeamLog\CollectionShareDetails.cs" />
<Compile Include="Generated\TeamLog\CollectionShareType.cs" />
Expand Down Expand Up @@ -837,6 +851,8 @@
<Compile Include="Generated\TeamLog\FileDeleteType.cs" />
<Compile Include="Generated\TeamLog\FileDownloadDetails.cs" />
<Compile Include="Generated\TeamLog\FileDownloadType.cs" />
<Compile Include="Generated\TeamLog\FileEditCommentDetails.cs" />
<Compile Include="Generated\TeamLog\FileEditCommentType.cs" />
<Compile Include="Generated\TeamLog\FileEditDetails.cs" />
<Compile Include="Generated\TeamLog\FileEditType.cs" />
<Compile Include="Generated\TeamLog\FileGetCopyReferenceDetails.cs" />
Expand Down Expand Up @@ -1397,6 +1413,8 @@
<Compile Include="Generated\TeamLog\TfaResetDetails.cs" />
<Compile Include="Generated\TeamLog\TfaResetType.cs" />
<Compile Include="Generated\TeamLog\TimeUnit.cs" />
<Compile Include="Generated\TeamLog\TrustedNonTeamMemberLogInfo.cs" />
<Compile Include="Generated\TeamLog\TrustedNonTeamMemberType.cs" />
<Compile Include="Generated\TeamLog\TwoAccountChangePolicyDetails.cs" />
<Compile Include="Generated\TeamLog\TwoAccountChangePolicyType.cs" />
<Compile Include="Generated\TeamLog\TwoAccountPolicy.cs" />
Expand Down
Loading

0 comments on commit 8abced6

Please sign in to comment.