From c741d85458e39592400a1dda324431584edbaba7 Mon Sep 17 00:00:00 2001 From: Nathan Windisch Date: Mon, 22 Jul 2024 02:11:27 +0100 Subject: [PATCH] Moved test code to it's own file --- test/reddit.test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/reddit.test.py diff --git a/test/reddit.test.py b/test/reddit.test.py new file mode 100644 index 0000000..0bac032 --- /dev/null +++ b/test/reddit.test.py @@ -0,0 +1,18 @@ +# First, we need to add the src to the path so we can import the class +import sys, os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../src"))) +# Unfortunately, we don't get any type hinting, but this does work :) +from reddit import Tools + +async def main(): + __user__ = { + "valves": Tools.UserValves( + USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" + ) + } + async def mock_event_emitter(event: dict): print("Event Emitted:", event["data"]) + await Tools().get_subreddit_feed("sysadmin", mock_event_emitter, __user__) + await Tools().get_user_feed("NathanWindisch", mock_event_emitter, __user__) + +import asyncio +if __name__ == "__main__": asyncio.run(main()) \ No newline at end of file