+ it('Should run action:api.user.created', async function () {
+ const user = await servers[0].users.create({ username: 'created_user' })
+ userId = user.id
+
+ await checkHook('action:api.user.created')
+ })
+
+ it('Should run action:api.user.oauth2-got-token', async function () {
+ await servers[0].login.login({ user: { username: 'created_user' } })
+
+ await checkHook('action:api.user.oauth2-got-token')
+ })
+
+ it('Should run action:api.user.blocked', async function () {
+ await servers[0].users.banUser({ userId })
+
+ await checkHook('action:api.user.blocked')
+ })
+
+ it('Should run action:api.user.unblocked', async function () {
+ await servers[0].users.unbanUser({ userId })
+
+ await checkHook('action:api.user.unblocked')
+ })
+
+ it('Should run action:api.user.updated', async function () {
+ await servers[0].users.update({ userId, videoQuota: 50 })
+
+ await checkHook('action:api.user.updated')
+ })
+
+ it('Should run action:api.user.deleted', async function () {
+ await servers[0].users.remove({ userId })
+
+ await checkHook('action:api.user.deleted')
+ })
+ })
+
+ describe('Playlist hooks', function () {
+ let playlistId: number
+ let videoId: number
+
+ before(async function () {
+ {
+ const { id } = await servers[0].playlists.create({
+ attributes: {
+ displayName: 'My playlist',
+ privacy: VideoPlaylistPrivacy.PRIVATE
+ }
+ })
+ playlistId = id
+ }
+
+ {
+ const { id } = await servers[0].videos.upload({ attributes: { name: 'my super name' } })
+ videoId = id
+ }
+ })
+
+ it('Should run action:api.video-playlist-element.created', async function () {
+ await servers[0].playlists.addElement({ playlistId, attributes: { videoId } })
+
+ await checkHook('action:api.video-playlist-element.created')
+ })