From 6910f20f114b5bd020258a3a9a3f2117819a60c2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Jul 2021 16:49:51 +0200 Subject: Introduce import command --- .../tests/api/notifications/user-notifications.ts | 30 ++++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'server/tests/api/notifications') diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts index 15be983f2..a9315c818 100644 --- a/server/tests/api/notifications/user-notifications.ts +++ b/server/tests/api/notifications/user-notifications.ts @@ -11,6 +11,7 @@ import { checkVideoIsPublished, cleanupTests, getLastNotification, + ImportsCommand, MockSmtpServer, prepareNotificationsTest, ServerInfo, @@ -21,7 +22,6 @@ import { wait, waitJobs } from '@shared/extra-utils' -import { getBadVideoUrl, getGoodVideoUrl, importVideo } from '@shared/extra-utils/videos/video-imports' import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models' const expect = chai.expect @@ -209,14 +209,13 @@ describe('Test user notifications', function () { name, channelId, privacy: VideoPrivacy.PUBLIC, - targetUrl: getGoodVideoUrl() + targetUrl: ImportsCommand.getGoodVideoUrl() } - const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) - const uuid = res.body.video.uuid + const { video } = await servers[0].importsCommand.importVideo({ attributes }) await waitJobs(servers) - await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') + await checkNewVideoFromSubscription(baseParams, name, video.uuid, 'presence') }) }) @@ -280,14 +279,13 @@ describe('Test user notifications', function () { name, channelId, privacy: VideoPrivacy.PUBLIC, - targetUrl: getGoodVideoUrl(), + targetUrl: ImportsCommand.getGoodVideoUrl(), waitTranscoding: true } - const res = await importVideo(servers[1].url, servers[1].accessToken, attributes) - const uuid = res.body.video.uuid + const { video } = await servers[1].importsCommand.importVideo({ attributes }) await waitJobs(servers) - await checkVideoIsPublished(baseParams, name, uuid, 'presence') + await checkVideoIsPublished(baseParams, name, video.uuid, 'presence') }) it('Should send a notification when the scheduled update has been proceeded', async function () { @@ -349,13 +347,12 @@ describe('Test user notifications', function () { name, channelId, privacy: VideoPrivacy.PRIVATE, - targetUrl: getBadVideoUrl() + targetUrl: ImportsCommand.getBadVideoUrl() } - const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) - const uuid = res.body.video.uuid + const { video } = await servers[0].importsCommand.importVideo({ attributes }) await waitJobs(servers) - await checkMyVideoImportIsFinished(baseParams, name, uuid, getBadVideoUrl(), false, 'presence') + await checkMyVideoImportIsFinished(baseParams, name, video.uuid, ImportsCommand.getBadVideoUrl(), false, 'presence') }) it('Should send a notification when the video import succeeded', async function () { @@ -367,13 +364,12 @@ describe('Test user notifications', function () { name, channelId, privacy: VideoPrivacy.PRIVATE, - targetUrl: getGoodVideoUrl() + targetUrl: ImportsCommand.getGoodVideoUrl() } - const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) - const uuid = res.body.video.uuid + const { video } = await servers[0].importsCommand.importVideo({ attributes }) await waitJobs(servers) - await checkMyVideoImportIsFinished(baseParams, name, uuid, getGoodVideoUrl(), true, 'presence') + await checkMyVideoImportIsFinished(baseParams, name, video.uuid, ImportsCommand.getGoodVideoUrl(), true, 'presence') }) }) -- cgit v1.2.3