From b5e7b72a701b465246bce94ca24ff234191c4d25 Mon Sep 17 00:00:00 2001 From: Emmie Maeda Date: Sun, 10 Mar 2024 17:25:44 -0400 Subject: [PATCH] Add forum_categories test. --- test/data/forum_categories.html | 1 + test/test_forum_categories.py | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 test/data/forum_categories.html create mode 100644 test/test_forum_categories.py diff --git a/test/data/forum_categories.html b/test/data/forum_categories.html new file mode 100644 index 0000000..e39cd8f --- /dev/null +++ b/test/data/forum_categories.html @@ -0,0 +1 @@ +
Site Announcements and Proposals
Announce new pages, suggest policy, and interact with new site members.
Category nameThreadsPostsLast post
Announcement of any sitewide changes or events. For usage by both staff and non-staff.
1906091by HeckkerHeckker
06 Mar 2024 02:21Jump!
Announce posting of new pages and deletion of old pages. Authors, please use the collective SCP, Tale, GoI Entry, and Update threads for new works.
17328560by NebulousStarNebulousStar
10 Mar 2024 18:58Jump!
What can we do to improve the site? Ask any questions you may have regarding site structure and policy.
95110920by EthagonEthagon
05 Mar 2024 14:16Jump!
New to the site? Introduce yourself and meet other site members here.
485238770by DrWilderDrWilder
10 Mar 2024 18:59Jump!
Staff Processes
Staff recruitment threads, discussion of proposed policy, and recaps of staff discussion.
Category nameThreadsPostsLast post
A space for users to comment on staff proposals for new site policy.
1762160by PedantiquePedantique
07 Mar 2024 02:33Jump!
For staff teams to recruit new members.
6146by FluffyKoboldFluffyKobold
07 Mar 2024 18:03Jump!
A place for the community to bring up concerns, suggestions, and issues with the SCP Wiki staff
27372by torcsandantlerstorcsandantlers
29 Jan 2024 01:10Jump!
SCP Universe
The world behind the articles.
Category nameThreadsPostsLast post
Discussion of things relating to both the SCP objects and the "universe" of the Foundation as a whole.
284527892by FrankEntropyFrankEntropy
10 Mar 2024 08:33Jump!
Writing Help
Get help with developing, writing, and editing your mainsite works! Please note that the IRC chatrooms move faster than the forums and are better for real-time conversation. PLEASE REMEMBER TO REACH OUT TO REVIEWERS TO REQUEST FEEDBACK, RATHER THAN JUST WAITING!
Category nameThreadsPostsLast post
Feedback on concepts and greenlights given here. Please only post sandbox pages if requested by a reviewer. Remember to contact reviewers to request feedback.
47252218299by QandQand
10 Mar 2024 21:01Jump!
Want to run your draft past the veterans? Post here. Please read the forum guidelines, and post a wordcount for your drafts! Remember to contact reviewers to request feedback.
29073136594by Blue FootBlue Foot
10 Mar 2024 01:29Jump!
Doing background research to use real-life knowledge to make in-universe articles sound professional.
5494171by ZynZyn
03 Feb 2024 20:10Jump!
If you've got questions about the sandbox, chat, formatting (wiki syntax/coding), or anything that involves the writing process and/or something you're currently writing, post here.
527522669by ZynZyn
09 Mar 2024 07:57Jump!
General Discussion
General forum discussion regarding interests, projects, and so on.
Category nameThreadsPostsLast post
General Discussion
144154245by alanthechairalanthechair
28 Feb 2024 17:18Jump!
General talk about things you play, or things you do, does not have to be SCP related. Includes SCP mods and Conventions you may go to!
5957162by Dr DirenniDr Direnni
08 Mar 2024 18:47Jump!
TV, Movies, Books and other noninteractive media, including creepypasta!
7319335by Dr DirenniDr Direnni
08 Mar 2024 18:50Jump!
A place where fan projects, art, and other stuff can be shown off or pimped, as needed.
125614451by iiMak13iiMak13
07 Mar 2024 18:44Jump!
Project Foundation
The place to discuss Project Foundation, staff's effort to migrate off of Wikidot.
Category nameThreadsPostsLast post
Information about PF: the plan, progress that's been made, Frequently Asked Questions, and whatever else may be relevant. Also the place to ask questions about PF.
73253by Oswald prcrxcOswald prcrxc
25 Dec 2023 12:00Jump!
What features or capabilities would you like to see in the next version of the Foundation website?
60174by IHearVoicesIHearVoices
02 Dec 2023 22:05Jump!
Per Page Discussions
Category nameThreadsPostsLast post
This category groups discussions related to particular pages within this site.
23996412912by PabloAxolotlPabloAxolotl
10 Mar 2024 20:57Jump!
Hidden
The place where old threads go to di- Err... Go to... the farm. Upstate. WITH LOTS OF FIELDS FOR THEM TO RUN THROUGH AND RABBITS TO CHASE.
Category nameThreadsPostsLast post
This forum is Archived and Locked.
2142231by OriTieflingOriTiefling
22 Jan 2024 16:29Jump!
This Forum is Archived and Locked.
2191523by luredfishluredfish
14 Feb 2024 21:42Jump!
The Forum is Archived and Locked.
9632726by ReillyinReillyin
08 Mar 2024 12:06Jump!
This Forum is Archived and Locked.
772by ZertasZertas
03 Apr 2022 13:15Jump!
This Forum is Archived and Locked.
60470by Doctor MurdenDoctor Murden
25 Jan 2014 23:03Jump!
This Forum is Archived and Locked.
6152by ZynZyn
21 May 2021 05:05Jump!

Hide hidden

rss icon RSS: New threads | New posts

\ No newline at end of file diff --git a/test/test_forum_categories.py b/test/test_forum_categories.py new file mode 100644 index 0000000..8c66e9e --- /dev/null +++ b/test/test_forum_categories.py @@ -0,0 +1,44 @@ +import unittest +from unittest.mock import patch + +import requests + +from yellowstone.request import forum_categories +from yellowstone.request.forum_categories import ForumGroupData + +from .helpers import FakeResponse, make_wikidot + + +class TestForumCategories(unittest.TestCase): + def setUp(self): + self.wikidot = make_wikidot() + + def test_forum_categories(self): + http_response = FakeResponse.ajax_from_file("forum_categories") + with patch.object(requests, "post", return_value=http_response) as mock: + models = forum_categories.get("scp-wiki", wikidot=self.wikidot) + mock.assert_called_once() + + self.assertEqual(len(models), 8) + self.assertIsInstance(models[0], ForumGroupData) + + self.assertEqual(models[0].name, "Site Announcements and Proposals") + self.assertEqual( + models[0].description, + "Announce new pages, suggest policy, and interact with new site members.", + ) + + self.assertEqual(len(models[0].categories), 4) + self.assertEqual(models[0].categories[0].name, "Sitewide Announcements") + self.assertEqual(models[0].categories[0].thread_count, 190) + self.assertEqual(models[0].categories[0].post_count, 6091) + self.assertEqual(models[0].categories[1].name, "Page Announcements") + self.assertEqual(models[0].categories[1].thread_count, 173) + self.assertEqual(models[0].categories[1].post_count, 28560) + + self.assertEqual(models[1].name, "Staff Processes") + self.assertTrue(models[1].description.startswith("Staff recruitment threads")) + self.assertEqual(len(models[1].categories), 3) + self.assertEqual(models[1].categories[0].name, "Staff Policy Discussions") + self.assertEqual(models[1].categories[0].thread_count, 176) + self.assertEqual(models[1].categories[0].post_count, 2160)