-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
0 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,8 @@ | ||
import unittest | ||
import sqlite3 | ||
from chatgptApp.main import on_clear_click | ||
from chatgptApp.main import insert_into_db | ||
|
||
|
||
class TestOnClearClick(unittest.TestCase): | ||
def test_on_clear_click(self): | ||
expected_output = ("", [], []) | ||
self.assertEqual(on_clear_click(), expected_output) | ||
|
||
|
||
def setup_module(module): | ||
global conn | ||
conn = sqlite3.connect(':memory:') | ||
c = conn.cursor() | ||
c.execute("CREATE TABLE chat_session_01 (question text, answer text)") | ||
|
||
|
||
def teardown_module(module): | ||
conn.close() | ||
|
||
|
||
def test_insert_into_db(): | ||
insert_into_db('Hello', 'World') | ||
c = conn.cursor() | ||
c.execute("SELECT * FROM chat_session_01") | ||
assert c.fetchone() == ('Hello', 'World') |