-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccda7c4
commit 3048821
Showing
26 changed files
with
153 additions
and
156 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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using FluentAssertions; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
@@ -105,19 +103,19 @@ public void HandleRequest_Returns_Webfinger_Response_When_Account_Is_Requested_I | |
var collectionStore = new Dictionary<string, StringValues> { { "resource", "acct:[email protected]" } }; | ||
_unitUnderTest.ControllerContext.HttpContext.Request.Query = new QueryCollection(collectionStore); | ||
|
||
_uActivitySettingsServiceMock.Setup(x => x.GetSettings(uActivitySettingKeys.SingleUserMode)) | ||
.Returns(new uActivitySettings | ||
_uActivitySettingsServiceMock.Setup(x => x.GetSettings(UActivitySettingKeys.SingleUserMode)) | ||
.Returns(new UActivitySettings | ||
{ | ||
Id = 1, | ||
Key = uActivitySettingKeys.SingleUserMode, | ||
Key = UActivitySettingKeys.SingleUserMode, | ||
Value = "true" | ||
}); | ||
|
||
_uActivitySettingsServiceMock.Setup(x => x.GetSettings(uActivitySettingKeys.SingleUserModeUserName)) | ||
.Returns(new uActivitySettings | ||
_uActivitySettingsServiceMock.Setup(x => x.GetSettings(UActivitySettingKeys.SingleUserModeUserName)) | ||
.Returns(new UActivitySettings | ||
{ | ||
Id = 2, | ||
Key = uActivitySettingKeys.SingleUserModeUserName, | ||
Key = UActivitySettingKeys.SingleUserModeUserName, | ||
Value = "uActivityPub" | ||
}); | ||
|
||
|
@@ -132,13 +130,13 @@ public void HandleRequest_Returns_Webfinger_Response_When_Account_Is_Requested_I | |
var objectResponse = response.Result as OkObjectResult; | ||
objectResponse.Should().NotBeNull(); | ||
objectResponse!.Value.Should().NotBeNull(); | ||
var webFingerResponse = objectResponse!.Value as WebFingerResponse; | ||
var webFingerResponse = objectResponse.Value as WebFingerResponse; | ||
webFingerResponse.Should().NotBeNull(); | ||
webFingerResponse!.Subject.Should().Be("acct:[email protected]"); | ||
webFingerResponse.Links.Length.Should().Be(1); | ||
webFingerResponse.Links.First().Rel.Should().Be("self"); | ||
webFingerResponse.Links.First().Type.Should().Be("application/activity+json"); | ||
webFingerResponse.Links.First().Href.Should().Be("https://localhost.test/activitypub/actor/uactivitypub"); | ||
webFingerResponse.Links[0].Rel.Should().Be("self"); | ||
webFingerResponse.Links[0].Type.Should().Be("application/activity+json"); | ||
webFingerResponse.Links[0].Href.Should().Be("https://localhost.test/activitypub/actor/uactivitypub"); | ||
} | ||
|
||
[Fact] | ||
|
@@ -152,11 +150,11 @@ public void HandleRequest_Returns_Webfinger_Response_When_Account_Is_Requested_N | |
var collectionStore = new Dictionary<string, StringValues> { { "resource", "acct:[email protected]" } }; | ||
_unitUnderTest.ControllerContext.HttpContext.Request.Query = new QueryCollection(collectionStore); | ||
|
||
_uActivitySettingsServiceMock.Setup(x => x.GetSettings(uActivitySettingKeys.SingleUserMode)) | ||
.Returns(new uActivitySettings | ||
_uActivitySettingsServiceMock.Setup(x => x.GetSettings(UActivitySettingKeys.SingleUserMode)) | ||
.Returns(new UActivitySettings | ||
{ | ||
Id = 1, | ||
Key = uActivitySettingKeys.SingleUserMode, | ||
Key = UActivitySettingKeys.SingleUserMode, | ||
Value = "false" | ||
}); | ||
|
||
|
@@ -181,13 +179,13 @@ public void HandleRequest_Returns_Webfinger_Response_When_Account_Is_Requested_N | |
var objectResponse = response.Result as OkObjectResult; | ||
objectResponse.Should().NotBeNull(); | ||
objectResponse!.Value.Should().NotBeNull(); | ||
var webFingerResponse = objectResponse!.Value as WebFingerResponse; | ||
var webFingerResponse = objectResponse.Value as WebFingerResponse; | ||
webFingerResponse.Should().NotBeNull(); | ||
webFingerResponse!.Subject.Should().Be("acct:[email protected]"); | ||
webFingerResponse.Links.Length.Should().Be(1); | ||
webFingerResponse.Links.First().Rel.Should().Be("self"); | ||
webFingerResponse.Links.First().Type.Should().Be("application/activity+json"); | ||
webFingerResponse.Links.First().Href.Should().Be("https://localhost.test/activitypub/actor/uactivitypub"); | ||
webFingerResponse.Links[0].Rel.Should().Be("self"); | ||
webFingerResponse.Links[0].Type.Should().Be("application/activity+json"); | ||
webFingerResponse.Links[0].Href.Should().Be("https://localhost.test/activitypub/actor/uactivitypub"); | ||
} | ||
|
||
[Fact] | ||
|
@@ -201,11 +199,11 @@ public void HandleRequest_Returns_NotFound_Response_When_Non_Existing_Account_Is | |
var collectionStore = new Dictionary<string, StringValues> { { "resource", "acct:[email protected]" } }; | ||
_unitUnderTest.ControllerContext.HttpContext.Request.Query = new QueryCollection(collectionStore); | ||
|
||
_uActivitySettingsServiceMock.Setup(x => x.GetSettings(uActivitySettingKeys.SingleUserMode)) | ||
.Returns(new uActivitySettings | ||
_uActivitySettingsServiceMock.Setup(x => x.GetSettings(UActivitySettingKeys.SingleUserMode)) | ||
.Returns(new UActivitySettings | ||
{ | ||
Id = 1, | ||
Key = uActivitySettingKeys.SingleUserMode, | ||
Key = UActivitySettingKeys.SingleUserMode, | ||
Value = "false" | ||
}); | ||
|
||
|
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
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 |
---|---|---|
|
@@ -6,49 +6,49 @@ namespace uActivityPub.Tests.TestHelpers; | |
|
||
public static class UActivitySettingsHelper | ||
{ | ||
public static List<uActivitySettings> GetSettings() | ||
public static List<UActivitySettings> GetSettings() | ||
{ | ||
return | ||
[ | ||
new uActivitySettings() | ||
new UActivitySettings() | ||
{ | ||
Id = 1, | ||
Key = uActivitySettingKeys.ContentTypeAlias, | ||
Key = UActivitySettingKeys.ContentTypeAlias, | ||
Value = "article" | ||
}, | ||
|
||
new uActivitySettings() | ||
new UActivitySettings() | ||
{ | ||
Id = 2, | ||
Key = uActivitySettingKeys.ListContentTypeAlias, | ||
Key = UActivitySettingKeys.ListContentTypeAlias, | ||
Value = "articleList" | ||
}, | ||
|
||
new uActivitySettings() | ||
new UActivitySettings() | ||
{ | ||
Id = 3, | ||
Key = uActivitySettingKeys.UserNameContentAlias, | ||
Key = UActivitySettingKeys.UserNameContentAlias, | ||
Value = "author" | ||
}, | ||
|
||
new uActivitySettings() | ||
new UActivitySettings() | ||
{ | ||
Id = 4, | ||
Key = uActivitySettingKeys.SingleUserMode, | ||
Key = UActivitySettingKeys.SingleUserMode, | ||
Value = "false" | ||
}, | ||
|
||
new uActivitySettings() | ||
new UActivitySettings() | ||
{ | ||
Id = 5, | ||
Key = uActivitySettingKeys.SingleUserModeUserName, | ||
Key = UActivitySettingKeys.SingleUserModeUserName, | ||
Value = "uActivityPub" | ||
}, | ||
|
||
new uActivitySettings() | ||
new UActivitySettings() | ||
{ | ||
Id = 6, | ||
Key = uActivitySettingKeys.GravatarEmail, | ||
Key = UActivitySettingKeys.GravatarEmail, | ||
Value = "[email protected]" | ||
} | ||
]; | ||
|
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
Oops, something went wrong.