ratelimiting.feature 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. Feature: ratelimiting
  2. Background:
  3. Given user "user0" exists
  4. Given As an "admin"
  5. Given invoking occ with "app:enable --force testing"
  6. Scenario: Accessing a page with only an AnonRateThrottle as user
  7. Given user "user0" exists
  8. # First request should work
  9. When requesting "/index.php/apps/testing/anonProtected" with "GET" using basic auth
  10. Then the HTTP status code should be "200"
  11. # Second one should fail
  12. When requesting "/index.php/apps/testing/anonProtected" with "GET" using basic auth
  13. Then the HTTP status code should be "429"
  14. # After 11 seconds the next request should work
  15. And Sleep for "11" seconds
  16. When requesting "/index.php/apps/testing/anonProtected" with "GET" using basic auth
  17. Then the HTTP status code should be "200"
  18. Scenario: Accessing a page with only an AnonRateThrottle as guest
  19. Given Sleep for "11" seconds
  20. # First request should work
  21. When requesting "/index.php/apps/testing/anonProtected" with "GET"
  22. Then the HTTP status code should be "200"
  23. # Second one should fail
  24. When requesting "/index.php/apps/testing/anonProtected" with "GET" using basic auth
  25. Then the HTTP status code should be "429"
  26. # After 11 seconds the next request should work
  27. And Sleep for "11" seconds
  28. When requesting "/index.php/apps/testing/anonProtected" with "GET" using basic auth
  29. Then the HTTP status code should be "200"
  30. Scenario: Accessing a page with UserRateThrottle and AnonRateThrottle
  31. # First request should work as guest
  32. When requesting "/index.php/apps/testing/userAndAnonProtected" with "GET"
  33. Then the HTTP status code should be "200"
  34. # Second request should fail as guest
  35. When requesting "/index.php/apps/testing/userAndAnonProtected" with "GET"
  36. Then the HTTP status code should be "429"
  37. # First request should work as user
  38. When requesting "/index.php/apps/testing/userAndAnonProtected" with "GET" using basic auth
  39. Then the HTTP status code should be "200"
  40. # Second request should work as user
  41. When requesting "/index.php/apps/testing/userAndAnonProtected" with "GET" using basic auth
  42. Then the HTTP status code should be "200"
  43. # Third request should work as user
  44. When requesting "/index.php/apps/testing/userAndAnonProtected" with "GET" using basic auth
  45. Then the HTTP status code should be "200"
  46. # Fourth request should work as user
  47. When requesting "/index.php/apps/testing/userAndAnonProtected" with "GET" using basic auth
  48. Then the HTTP status code should be "200"
  49. # Fifth request should work as user
  50. When requesting "/index.php/apps/testing/userAndAnonProtected" with "GET" using basic auth
  51. Then the HTTP status code should be "200"
  52. # Sixth request should fail as user
  53. When requesting "/index.php/apps/testing/userAndAnonProtected" with "GET"
  54. Then the HTTP status code should be "429"