Skip to content

Commit

Permalink
Seperated account test extensions into its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
pingu2k4 committed Aug 10, 2024
1 parent 2b66de2 commit cd6d39b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,3 @@ public void SetSession_UpdatesSession()
Assert.Equal(Constants.Session, accountClient.Session);
}
}

public static class AccountTestsExtensions
{
public static MockedRequest ExpectedHeaders(this MockedRequest request, bool addSessionHeaders = false)
{
var req = request
.WithHeaders("x-appwrite-project", Constants.ProjectId)
.WithHeaders("x-sdk-name", Constants.SdkName)
.WithHeaders("x-sdk-platform", "client")
.WithHeaders("x-sdk-language", Constants.SdkLanguage)
.WithHeaders("x-sdk-version", Constants.SdkVersion)
.WithHeaders("x-appwrite-response-format", Constants.AppwriteResponseFormat);

if (addSessionHeaders)
return req.ExpectSessionHeaders();

return req;
}

public static MockedRequest ExpectSessionHeaders(this MockedRequest request)
{
return request
.WithHeaders("x-appwrite-session", Constants.Session);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using PinguApps.Appwrite.Shared.Tests;
using RichardSzalay.MockHttp;

namespace PinguApps.Appwrite.Client.Tests.Clients.Account;

public static class AccountTestsExtensions
{
public static MockedRequest ExpectedHeaders(this MockedRequest request, bool addSessionHeaders = false)
{
var req = request
.WithHeaders("x-appwrite-project", Constants.ProjectId)
.WithHeaders("x-sdk-name", Constants.SdkName)
.WithHeaders("x-sdk-platform", "client")
.WithHeaders("x-sdk-language", Constants.SdkLanguage)
.WithHeaders("x-sdk-version", Constants.SdkVersion)
.WithHeaders("x-appwrite-response-format", Constants.AppwriteResponseFormat);

if (addSessionHeaders)
return req.ExpectSessionHeaders();

return req;
}

public static MockedRequest ExpectSessionHeaders(this MockedRequest request)
{
return request
.WithHeaders("x-appwrite-session", Constants.Session);
}
}

0 comments on commit cd6d39b

Please sign in to comment.