+
+ await server.users.register({ username: 'test43', expectedStatus: HttpStatusCode.NO_CONTENT_204 })
+
+ })
+
+ it('Should rate limit API calls', async function () {
+ this.timeout(30000)
+
+ await wait(7000)
+
+ for (let i = 0; i < 100; i++) {
+ try {
+ await server.videos.get({ id: videoId })
+ } catch {
+ // don't care if it fails
+ }
+ }
+
+ await server.videos.get({ id: videoId, expectedStatus: HttpStatusCode.TOO_MANY_REQUESTS_429 })
+ })
+
+ it('Should rate limit API calls with a user but not with an admin', async function () {
+ await server.videos.get({ id: videoId, token: userAccessToken, expectedStatus: HttpStatusCode.TOO_MANY_REQUESTS_429 })
+
+ await server.videos.get({ id: videoId, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 })
+ })
+
+ after(async function () {
+ await cleanupTests([ server ])