tests folder (automated tests??) #430
-
@TheCommCraft What is the I am asking this because I wanted to make some scripts for automated testing Also, is there a way to add environment variables when running a github action? What I mean is that some automated tests would involve authentication, so that e.g. commenting can be tested - but this requires either a password, session id, or session string. Is there a way to add this to the repository (store on github) - but not make it public? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
would something like this be a good idea? import os
import warnings
import scratchattach as sa
warnings.filterwarnings("ignore", category=sa.LoginDataWarning)
password = os.environ["SCRATCHATTACH-TEST-PW"]
sess = sa.login("scratchattach-tests", password)
assert sess.id is not None
assert sess.username == "scratchattach-tests"
assert sess.xtoken is not None
assert sess.connect_linked_user().id == "157124692" # should user ids be ints? |
Beta Was this translation helpful? Give feedback.
-
But Tim would need to add it as a secret i think |
Beta Was this translation helpful? Give feedback.
-
The test_import function is automatically run by pytest before the workflow deploys a new version of scratchattach. Any functions starting with "test" in the tests folder will have this behaviour. |
Beta Was this translation helpful? Give feedback.
The test_import function is automatically run by pytest before the workflow deploys a new version of scratchattach. Any functions starting with "test" in the tests folder will have this behaviour.