Skip to content

Commit

Permalink
#116 Use dman2 wiki for FANDOM CI automation tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
CXuesong committed Oct 10, 2024
1 parent be7e9cf commit c4d525a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
5 changes: 2 additions & 3 deletions UnitTestProject1/Endpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ public static class Endpoints

public const string WikidataBeta = "https://wikidata.beta.wmflabs.org/w/api.php";

// Suggested by KockaAdmiralac.
// It's on MW 1.33 now. Well.
public const string WikiaTest = "https://dman.fandom.com/api.php";
// It's on MW 1.39 now. Well.
public const string WikiaTest = "https://dman2.fandom.com/api.php";

// It's on MW 1.19 as of now.
public const string TFWiki = "https://tfwiki.net/api.php";
Expand Down
6 changes: 5 additions & 1 deletion UnitTestProject1/Tests/RevisionGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ public async Task WpTestEnumRevisionsTest3()
public async Task WikiaEnumRevisionsTest1()
{
var site = await WikiaTestSiteAsync;
var page = new WikiPage(site, "Dman Wikia");
var page = new WikiPage(site, "DMan \u2161 Wiki");
await page.RefreshAsync();
// Sanity check: the page exists.
Assert.True(page.Exists);

var gen = page.CreateRevisionsGenerator();
gen.PaginationSize = 20;
var revisions = await gen.EnumItemsAsync().Skip(5).Take(5).ToListAsync();
Expand Down
6 changes: 3 additions & 3 deletions UnitTestProject1/Tests/SiteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task TestWikia()
{
var site = await WikiaTestSiteAsync;
ShallowTrace(site);
Assert.Equal("Discussion Manual Wiki", site.SiteInfo.SiteName);
Assert.Equal("DMan Ⅱ Wiki", site.SiteInfo.SiteName);
ValidateNamespaces(site);
}

Expand Down Expand Up @@ -214,12 +214,12 @@ public async Task WpTest2OpenSearchTest()
public async Task WikiaOpenSearchTest()
{
var site = await WikiaTestSiteAsync;
var result = await Task.WhenAll(site.OpenSearchAsync("Dman Wi"),
var result = await Task.WhenAll(site.OpenSearchAsync("Dman Ⅱ W"),
site.OpenSearchAsync("THISTITLEDOESNOTEXIST"));
ShallowTrace(result[0]);
ShallowTrace(result[1]);
Assert.True(result[0].Count > 0);
Assert.Contains(result[0], e => e.Title == "Dman Wikia");
Assert.Contains(result[0], e => e.Title == "DMan \u2161 Wiki");
Assert.True(result[1].Count == 0);
}

Expand Down
6 changes: 3 additions & 3 deletions UnitTestProject1/Tests/WikiaApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ public async Task FetchUsersTest()
Assert.Equal(2, users.Length);
Assert.Equal("Jasonr", users[0].Name);
Assert.Equal("Jasonr", users[0].Title);
Assert.Equal("https://dman.fandom.com/wiki/User:Jasonr", users[0].UserPageUrl);
Assert.Equal(Uri.UnescapeDataString(site.SiteInfo.MakeArticleUrl("User:Jasonr")), users[0].UserPageUrl);
Assert.Equal(1, users[0].Id);
Assert.Equal("Angela", users[1].Name);
Assert.Equal("Angela", users[1].Title);
Assert.Equal("https://dman.fandom.com/wiki/User:Angela", users[1].UserPageUrl);
Assert.Equal(Uri.UnescapeDataString(site.SiteInfo.MakeArticleUrl("User:Angela")), users[1].UserPageUrl);
Assert.Equal(2, users[1].Id);
var user = await site.FetchUserAsync("__mattisManzel_");
Assert.Equal("MattisManzel", user.Name);
Assert.Equal("MattisManzel", user.Title);
Assert.Equal("https://dman.fandom.com/wiki/User:MattisManzel", user.UserPageUrl);
Assert.Equal(Uri.UnescapeDataString(site.SiteInfo.MakeArticleUrl("User:MattisManzel")), user.UserPageUrl);
Assert.Equal(4, user.Id);
user = await site.FetchUserAsync("user_not_exist");
Assert.Null(user);
Expand Down
8 changes: 4 additions & 4 deletions WikiClientLibrary/Generators/RevisionsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected override Revision ItemFromJson(JsonNode json, JsonObject jpage)
}

/// <summary>
/// Whether to list revisions in an ascending order of time.
/// Whether to list revisions in ascending order of time.
/// </summary>
/// <value><c>true</c>, if oldest revisions are listed first; or <c>false</c>, if newest revisions are listed first.</value>
/// <remarks>
Expand Down Expand Up @@ -115,7 +115,7 @@ public RevisionsPropertyProvider PropertyProvider
/// Asynchronously enumerates the pages from generator.</summary>
/// <remarks>
/// Using <c>revisions</c> as generator is not supported until MediaWiki 1.25.
/// Usually this generator will only returns the title specified in
/// Usually this generator will only return the title specified in
/// <see cref="WikiPagePropertyList{T}.PageTitle"/> or <see cref="WikiPagePropertyList{T}.PageId"/>.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
Expand All @@ -129,7 +129,7 @@ public override IAsyncEnumerable<WikiPage> EnumPagesAsync()
/// Asynchronously enumerates the pages from generator.</summary>
/// <remarks>
/// Using <c>revisions</c> as generator is not supported until MediaWiki 1.25.
/// Usually this generator will only returns the title specified in
/// Usually this generator will only return the title specified in
/// <see cref="WikiPagePropertyList{T}.PageTitle"/> or <see cref="WikiPagePropertyList{T}.PageId"/>.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
Expand All @@ -143,7 +143,7 @@ public override IAsyncEnumerable<WikiPage> EnumPagesAsync(PageQueryOptions optio
/// Asynchronously enumerates the pages from generator.</summary>
/// <remarks>
/// Using <c>revisions</c> as generator is not supported until MediaWiki 1.25.
/// Usually this generator will only returns the title specified in
/// Usually this generator will only return the title specified in
/// <see cref="WikiPagePropertyList{T}.PageTitle"/> or <see cref="WikiPagePropertyList{T}.PageId"/>.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
Expand Down

0 comments on commit c4d525a

Please sign in to comment.