|
@@ -0,0 +1,66 @@
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+import requests
|
|
|
+
|
|
|
+
|
|
|
+url = "http://localhost:4000/api/"
|
|
|
+
|
|
|
+def get_messages(fourletters):
|
|
|
+ r = requests.get(url + fourletters)
|
|
|
+ messages = r.json()['messages']
|
|
|
+ return messages
|
|
|
+
|
|
|
+def clear_messages(fourletters):
|
|
|
+ r = requests.delete(url + fourletters)
|
|
|
+
|
|
|
+def add_message(fourletters, message):
|
|
|
+ r = requests.post(url + fourletters + f"?message={message}")
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+test_fourletters = "dumb"
|
|
|
+print(f"im going to test fourletters with 'dumb'")
|
|
|
+
|
|
|
+
|
|
|
+clear_messages(test_fourletters)
|
|
|
+print(" clearing the messages")
|
|
|
+
|
|
|
+
|
|
|
+messages = get_messages(test_fourletters)
|
|
|
+assert messages == []
|
|
|
+print(" messages are clear")
|
|
|
+
|
|
|
+
|
|
|
+add_message(test_fourletters, "yo")
|
|
|
+print(" sending a message: 'yo'")
|
|
|
+
|
|
|
+
|
|
|
+messages = get_messages(test_fourletters)
|
|
|
+assert messages == ["yo"]
|
|
|
+print(f" messages are now {messages}")
|
|
|
+
|
|
|
+
|
|
|
+add_message(test_fourletters, "mama")
|
|
|
+print(" sending a message: 'mama'")
|
|
|
+
|
|
|
+
|
|
|
+messages = get_messages(test_fourletters)
|
|
|
+assert messages == ["yo", "mama"]
|
|
|
+print(f" messages are now {messages}")
|
|
|
+
|
|
|
+
|
|
|
+clear_messages(test_fourletters)
|
|
|
+print(" clearing the messages")
|
|
|
+
|
|
|
+
|
|
|
+messages = get_messages(test_fourletters)
|
|
|
+assert messages == []
|
|
|
+print(" messages are clear")
|
|
|
+
|
|
|
+print("test was a success!")
|