Unit testing weyhay

This commit is contained in:
simonwt 2026-04-01 21:42:11 +01:00
parent c27a89b8f9
commit b47f651323
3 changed files with 45 additions and 0 deletions

View file

@ -11,6 +11,9 @@ if not os.getenv("client_id") or not os.getenv("client_secret"):
raise Exception("Please set client_id and client_secret in your environment variables.")
# Initialize API client with credentials from environment variables
'''
THIS IS THE IMPORTANT BIT
'''
API = APIClient(
client_id=os.getenv("client_id"),
client_secret=os.getenv("client_secret"),
@ -31,10 +34,18 @@ if not API.is_token_valid():
with open("token_data.json", "w") as f:
json.dump(tokendata, f, indent=2)
'''
END IMPORTANT BIT
'''
# This is just to stop bunging up the console with output whilst
# doing these tests below
def save_response(response):
with open("test_output.json", "w") as f:
json.dump(response, f, indent=2)
# print("-----------Get a user profile----------------")
# profile = API.run_job('userprofile.get', "simon-little")
# print(profile)
@ -111,6 +122,7 @@ def save_response(response):
# }))
# save_response(API.run_job('post.listall'))
# save_response(API.run_job('post.listpublic'))
from wrappers.post.create_post import create_post