Rename tests to test_add_person.py
Browse files- test_add_person.py +27 -0
- tests +0 -0
test_add_person.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit.testing as stt
|
| 2 |
+
|
| 3 |
+
# Define a test case for adding a person
|
| 4 |
+
def test_add_person():
|
| 5 |
+
# Simulate user input
|
| 6 |
+
with stt.install_test_input():
|
| 7 |
+
stt.test_runner.start("path_to_your_script.py") # Path to your Streamlit script
|
| 8 |
+
|
| 9 |
+
# Select the "Add Person" option
|
| 10 |
+
stt.test_input("Select Option", "Add Person")
|
| 11 |
+
|
| 12 |
+
# Enter name, image path, and Instagram handle
|
| 13 |
+
stt.test_input("Enter Name", "John Doe")
|
| 14 |
+
stt.test_input("Upload Image", "path_to_image.jpg") # Path to your test image
|
| 15 |
+
stt.test_input("Enter Instagram Handle", "johndoe123")
|
| 16 |
+
|
| 17 |
+
# Click the "Add Person" button
|
| 18 |
+
stt.test_input("Add Person")
|
| 19 |
+
|
| 20 |
+
# Verify the success message
|
| 21 |
+
stt.test_output("Success: John Doe added to the database!")
|
| 22 |
+
|
| 23 |
+
# Clean up
|
| 24 |
+
stt.test_runner.cleanup()
|
| 25 |
+
|
| 26 |
+
# Run the test case
|
| 27 |
+
test_add_person()
|
tests
DELETED
|
File without changes
|