test_tools.py 396 B

1234567891011121314
  1. import string
  2. import requests
  3. import random
  4. host = "http://localhost:4000"
  5. def add_message_api(fourletters, mess):
  6. return f"{host}/api/{fourletters}?message={mess}"
  7. def add_50_rand_messages(fourletters):
  8. for i in range(50):
  9. word = ''.join(random.sample(string.ascii_lowercase, 10))
  10. requests.post(add_message_api(fourletters, word))
  11. add_50_rand_messages("yooo")