Would be great for you to make unittests for your module. Develop new features without breaking old ones, or ones you forgot you developed.
import unittest
from dotenv import load_dotenv
from unlimitedgpt import ChatGPT
class UnlimitedGPTRegressionTest(unittest.TestCase):
def setUp(self):
self.session_token_1 = os.getenv("SESSION_TOKEN_1")
self.session_token_2 = os.getenv("SESSION_TOKEN_2")
self.api = ChatGPT(self.session_token_1 )
def test_send_message(self):
message = self.api.send_message("Hello World")
# Add assertions to check the response
def test_get_session_data(self):
session_data = self.api.get_session_data()
# Add assertions to check the session data
def test_toggle_chat_history(self):
self.api.toggle_chat_history(False)
# Add assertions to check if chat history is toggled off
self.api.toggle_chat_history(True)
# Add assertions to check if chat history is toggled on again
def test_switch_theme(self):
self.api.switch_theme("DARK")
# Add assertions to check if theme is switched to DARK
def test_clear_conversations(self):
self.api.clear_conversations()
# Add assertions to check if conversations are cleared
def test_reset_conversation(self):
self.api.reset_conversation()
# Add assertions to check if conversation is reset
def test_switch_conversation(self):
self.api.switch_conversation("conversation-id")
# Add assertions to check if conversation is switched to "conversation-id"
def test_switch_account(self):
self.api.switch_account(self.session_token_2 )
# Add assertions to check if account is switched to "new-session-token"
def test_logout(self):
self.api.logout()
# Add assertions to check if logout is successful
if __name__ == "__main__":
unittest.main()
You can make a template env file to store your tokens template.env
Would be great for you to make unittests for your module. Develop new features without breaking old ones, or ones you forgot you developed.
You can make a template env file to store your tokens
template.env
You can push
template.env
to the repo. People could rename it to.env
(also need to add .env to .gitignore) and put their tokens for testing