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.

56 lines
1.6 KiB

  1. #!/usr/bin/env python
  2. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  3. # not use this file except in compliance with the License. You may obtain
  4. # a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  10. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  11. # License for the specific language governing permissions and limitations
  12. # under the License.
  13. import json
  14. import requests
  15. url = 'http://127.0.0.1/api/fractal'
  16. headers = {'Content-Type': 'application/json'}
  17. uuid = '13bf15a8-9f6c-4d59-956f-7d20f7484687'
  18. data = {
  19. 'uuid': uuid,
  20. 'width': 100,
  21. 'height': 100,
  22. 'iterations': 10,
  23. 'xa': 1.0,
  24. 'xb': -1.0,
  25. 'ya': 1.0,
  26. 'yb': -1.0,
  27. }
  28. response = requests.post(url, data=json.dumps(data), headers=headers)
  29. assert response.status_code == 201
  30. response = requests.get(url, headers=headers)
  31. assert response.status_code == 200
  32. print((response.json()))
  33. response = requests.get(url + '/' + uuid, headers=headers)
  34. assert response.status_code == 200
  35. print((response.json()))
  36. data = {
  37. 'checksum': 'c6fef4ef13a577066c2281b53c82ce2c7e94e',
  38. 'duration': 10.12
  39. }
  40. response = requests.put(url + '/' + uuid, data=json.dumps(data),
  41. headers=headers)
  42. assert response.status_code == 200
  43. response = requests.get(url + '/' + uuid, headers=headers)
  44. assert response.status_code == 200
  45. print((response.json()))
  46. response = requests.delete(url + '/' + uuid, headers=headers)
  47. assert response.status_code == 204