-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_gpt4.py
47 lines (38 loc) · 1.41 KB
/
test_gpt4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import unittest
import os
from api.gpt4 import GPT4
class TestGpt4(unittest.TestCase):
def setUp(self):
# Read username and password from environment variables
username = os.environ.get('USERNAME')
password = os.environ.get('PASSWORD')
url = os.environ.get('URL')
# Write username and password to a temporary config file
temp_config_path = 'temp_config.ini'
with open(temp_config_path, 'w') as config_file:
config_file.write("[CREDENTIALS]\n")
config_file.write(f"username = {username}\n")
config_file.write(f"password = {password}\n")
config_file.write("url = https://copilot.microsoft.com\n")
config_file.write("driver_path = None\n")
# Initialize GPT4 with the temporary config file
self.ap = GPT4(config_file=temp_config_path)
def test_login(self):
self.ap.login()
pass
def test_ask_question(self):
question = 'Test question'
self.ap.login()
self.ap.ask_question(question,20)
response = self.ap.get_response()
pass
def test_design(self):
question = 'A cow'
self.ap.login()
self.ap.design(question)
pass
def tearDown(self):
os.remove('temp_config.ini')
self.ap.close()
if __name__ == '__main__':
unittest.main()