RXSM update server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

42 line
1.5KB

  1. # Created 2019-09-11 by NGnius
  2. import requests
  3. # this is mainly smoke-testing since
  4. # writing complete and proper unit testing for a single-file server is out of scope
  5. # /release test
  6. print('Testing /release')
  7. raw_token = input('token password: ')
  8. release_resp = requests.post('http://localhost:9080/release', json={'token':raw_token, 'version':'v42.0.0a', 'platform':'fake-i386', 'url':'https://google.com'})
  9. print(release_resp.json())
  10. assert release_resp.status_code == 200
  11. print('Release Ok')
  12. # /database test
  13. print('Testing /database')
  14. database_resp = requests.get('http://localhost:9080/database')
  15. assert database_resp.status_code == 200
  16. print('Database Ok')
  17. # /update test
  18. print('Testing /update existing platform')
  19. update_resp = requests.post('http://localhost:9080/update', json={'version':'v0.42.0a', 'platform':'fake-i386'})
  20. print(update_resp.json())
  21. assert update_resp.status_code == 200
  22. assert update_resp.json()['url'] == 'https://google.com'
  23. print('Testing /update missing platform')
  24. update_resp = requests.post('http://localhost:9080/update', json={'version':'v0.42.0a', 'platform':'fake-amd64'})
  25. print(update_resp.json())
  26. assert update_resp.status_code == 404
  27. assert update_resp.json()['url'] == ''
  28. print('Update Ok')
  29. print('Testing /update DNT')
  30. update_resp = requests.post('http://localhost:9080/update', json={'version':'v0.42.0a', 'platform':'fake-i386'}, headers={"DNT": "1"})
  31. print(update_resp.json())
  32. assert update_resp.status_code == 200
  33. assert update_resp.json()['url'] == 'https://google.com'
  34. print('Update Ok')