From: Chocobozzz Date: Thu, 7 Jun 2018 07:48:10 +0000 (+0200) Subject: Move fixtures in tests/ X-Git-Tag: v1.0.0-beta.8~30 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=99d103019c76c517ba607a0fab8022aa6d08ef2e;p=oweals%2Fpeertube.git Move fixtures in tests/ --- diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index e8a6ffd19..dba57778d 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts @@ -279,7 +279,7 @@ describe('Test users API validators', function () { it('Should fail without an incorrect input file', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', 'fixtures', 'video_short.mp4') + 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) }) @@ -287,7 +287,7 @@ describe('Test users API validators', function () { it('Should fail with a big file', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', 'fixtures', 'avatar-big.png') + 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) }) @@ -295,7 +295,7 @@ describe('Test users API validators', function () { it('Should succeed with the correct params', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', 'fixtures', 'avatar.png') + 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 7b40b91e7..bc6c7fc46 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -163,7 +163,7 @@ describe('Test videos API validator', function () { describe('When adding a video', function () { let baseCorrectParams const baseCorrectAttaches = { - 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.webm') } before(function () { @@ -313,7 +313,7 @@ describe('Test videos API validator', function () { it('Should fail without an incorrect input file', async function () { const fields = baseCorrectParams const attaches = { - 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) }) @@ -321,8 +321,8 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar.png'), - 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') + 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'), + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -331,8 +331,8 @@ describe('Test videos API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar-big.png'), - 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') + 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'), + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -341,8 +341,8 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(__dirname, '..', 'fixtures', 'avatar.png'), - 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') + 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'), + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -351,8 +351,8 @@ describe('Test videos API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(__dirname, '..', 'fixtures', 'avatar-big.png'), - 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') + 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'), + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -377,7 +377,7 @@ describe('Test videos API validator', function () { { const attaches = immutableAssign(baseCorrectAttaches, { - videofile: join(__dirname, '..', 'fixtures', 'video_short.mp4') + videofile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') }) await makeUploadRequest({ @@ -392,7 +392,7 @@ describe('Test videos API validator', function () { { const attaches = immutableAssign(baseCorrectAttaches, { - videofile: join(__dirname, '..', 'fixtures', 'video_short.ogv') + videofile: join(__dirname, '..', '..', 'fixtures', 'video_short.ogv') }) await makeUploadRequest({ @@ -510,7 +510,7 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar.png') + 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ @@ -526,7 +526,7 @@ describe('Test videos API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar-big.png') + 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ @@ -542,7 +542,7 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(__dirname, '..', 'fixtures', 'avatar.png') + 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ @@ -558,7 +558,7 @@ describe('Test videos API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(__dirname, '..', 'fixtures', 'avatar-big.png') + 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ diff --git a/server/tests/api/fixtures/avatar-big.png b/server/tests/api/fixtures/avatar-big.png deleted file mode 100644 index e593e40da..000000000 Binary files a/server/tests/api/fixtures/avatar-big.png and /dev/null differ diff --git a/server/tests/api/fixtures/avatar-resized.png b/server/tests/api/fixtures/avatar-resized.png deleted file mode 100644 index 9d84151f8..000000000 Binary files a/server/tests/api/fixtures/avatar-resized.png and /dev/null differ diff --git a/server/tests/api/fixtures/avatar.png b/server/tests/api/fixtures/avatar.png deleted file mode 100644 index 4b7fd2c0a..000000000 Binary files a/server/tests/api/fixtures/avatar.png and /dev/null differ diff --git a/server/tests/api/fixtures/avatar2-resized.png b/server/tests/api/fixtures/avatar2-resized.png deleted file mode 100644 index 44149facb..000000000 Binary files a/server/tests/api/fixtures/avatar2-resized.png and /dev/null differ diff --git a/server/tests/api/fixtures/avatar2.png b/server/tests/api/fixtures/avatar2.png deleted file mode 100644 index dae702190..000000000 Binary files a/server/tests/api/fixtures/avatar2.png and /dev/null differ diff --git a/server/tests/api/fixtures/preview.jpg b/server/tests/api/fixtures/preview.jpg deleted file mode 100644 index c40ece838..000000000 Binary files a/server/tests/api/fixtures/preview.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/thumbnail.jpg b/server/tests/api/fixtures/thumbnail.jpg deleted file mode 100644 index cc3af8a4a..000000000 Binary files a/server/tests/api/fixtures/thumbnail.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/video_60fps_short.mp4 b/server/tests/api/fixtures/video_60fps_short.mp4 deleted file mode 100644 index ff0593cf3..000000000 Binary files a/server/tests/api/fixtures/video_60fps_short.mp4 and /dev/null differ diff --git a/server/tests/api/fixtures/video_short-480.webm b/server/tests/api/fixtures/video_short-480.webm deleted file mode 100644 index 3145105e1..000000000 Binary files a/server/tests/api/fixtures/video_short-480.webm and /dev/null differ diff --git a/server/tests/api/fixtures/video_short.mp4 b/server/tests/api/fixtures/video_short.mp4 deleted file mode 100644 index 35678362b..000000000 Binary files a/server/tests/api/fixtures/video_short.mp4 and /dev/null differ diff --git a/server/tests/api/fixtures/video_short.mp4.jpg b/server/tests/api/fixtures/video_short.mp4.jpg deleted file mode 100644 index 48790ffec..000000000 Binary files a/server/tests/api/fixtures/video_short.mp4.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/video_short.ogv b/server/tests/api/fixtures/video_short.ogv deleted file mode 100644 index 9e253da82..000000000 Binary files a/server/tests/api/fixtures/video_short.ogv and /dev/null differ diff --git a/server/tests/api/fixtures/video_short.ogv.jpg b/server/tests/api/fixtures/video_short.ogv.jpg deleted file mode 100644 index c4c1d00e5..000000000 Binary files a/server/tests/api/fixtures/video_short.ogv.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/video_short.webm b/server/tests/api/fixtures/video_short.webm deleted file mode 100644 index bf4b0ab6c..000000000 Binary files a/server/tests/api/fixtures/video_short.webm and /dev/null differ diff --git a/server/tests/api/fixtures/video_short.webm.jpg b/server/tests/api/fixtures/video_short.webm.jpg deleted file mode 100644 index b0dffd099..000000000 Binary files a/server/tests/api/fixtures/video_short.webm.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/video_short1-preview.webm.jpg b/server/tests/api/fixtures/video_short1-preview.webm.jpg deleted file mode 100644 index d2a068b78..000000000 Binary files a/server/tests/api/fixtures/video_short1-preview.webm.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/video_short1.webm b/server/tests/api/fixtures/video_short1.webm deleted file mode 100644 index 70ac0c644..000000000 Binary files a/server/tests/api/fixtures/video_short1.webm and /dev/null differ diff --git a/server/tests/api/fixtures/video_short1.webm.jpg b/server/tests/api/fixtures/video_short1.webm.jpg deleted file mode 100644 index 2db21975c..000000000 Binary files a/server/tests/api/fixtures/video_short1.webm.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/video_short2.webm b/server/tests/api/fixtures/video_short2.webm deleted file mode 100644 index 13d72dff7..000000000 Binary files a/server/tests/api/fixtures/video_short2.webm and /dev/null differ diff --git a/server/tests/api/fixtures/video_short2.webm.jpg b/server/tests/api/fixtures/video_short2.webm.jpg deleted file mode 100644 index ed5952e04..000000000 Binary files a/server/tests/api/fixtures/video_short2.webm.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/video_short3.webm b/server/tests/api/fixtures/video_short3.webm deleted file mode 100644 index cde5dcd58..000000000 Binary files a/server/tests/api/fixtures/video_short3.webm and /dev/null differ diff --git a/server/tests/api/fixtures/video_short3.webm.jpg b/server/tests/api/fixtures/video_short3.webm.jpg deleted file mode 100644 index b7c41cc1a..000000000 Binary files a/server/tests/api/fixtures/video_short3.webm.jpg and /dev/null differ diff --git a/server/tests/api/fixtures/video_short_fake.webm b/server/tests/api/fixtures/video_short_fake.webm deleted file mode 100644 index d85290ae5..000000000 --- a/server/tests/api/fixtures/video_short_fake.webm +++ /dev/null @@ -1 +0,0 @@ -this is a fake video mouahahah diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index fc7c0cb21..5f9a76621 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -938,7 +938,7 @@ describe('Test multiple servers', function () { .field('channelId', '1') .field('commentsEnabled', 'true') - const filePath = join(__dirname, '..', '..', 'api', 'fixtures', 'video_short.webm') + const filePath = join(__dirname, '..', '..', 'fixtures', 'video_short.webm') await req.attach('videofile', filePath) .expect(200) diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index 251088882..372c7e517 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts @@ -59,7 +59,7 @@ describe('Test create import video jobs', function () { it('Should run a import job on video 1 with a lower resolution', async function () { const env = getEnvCli(servers[0]) - await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/api/fixtures/video_short-480.webm`) + await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm`) await wait(30000) @@ -83,7 +83,7 @@ describe('Test create import video jobs', function () { it('Should run a import job on video 2 with the same resolution', async function () { const env = getEnvCli(servers[1]) - await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/api/fixtures/video_short.ogv`) + await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`) await wait(30000) diff --git a/server/tests/fixtures/avatar-big.png b/server/tests/fixtures/avatar-big.png new file mode 100644 index 000000000..e593e40da Binary files /dev/null and b/server/tests/fixtures/avatar-big.png differ diff --git a/server/tests/fixtures/avatar-resized.png b/server/tests/fixtures/avatar-resized.png new file mode 100644 index 000000000..9d84151f8 Binary files /dev/null and b/server/tests/fixtures/avatar-resized.png differ diff --git a/server/tests/fixtures/avatar.png b/server/tests/fixtures/avatar.png new file mode 100644 index 000000000..4b7fd2c0a Binary files /dev/null and b/server/tests/fixtures/avatar.png differ diff --git a/server/tests/fixtures/avatar2-resized.png b/server/tests/fixtures/avatar2-resized.png new file mode 100644 index 000000000..44149facb Binary files /dev/null and b/server/tests/fixtures/avatar2-resized.png differ diff --git a/server/tests/fixtures/avatar2.png b/server/tests/fixtures/avatar2.png new file mode 100644 index 000000000..dae702190 Binary files /dev/null and b/server/tests/fixtures/avatar2.png differ diff --git a/server/tests/fixtures/preview.jpg b/server/tests/fixtures/preview.jpg new file mode 100644 index 000000000..c40ece838 Binary files /dev/null and b/server/tests/fixtures/preview.jpg differ diff --git a/server/tests/fixtures/thumbnail.jpg b/server/tests/fixtures/thumbnail.jpg new file mode 100644 index 000000000..cc3af8a4a Binary files /dev/null and b/server/tests/fixtures/thumbnail.jpg differ diff --git a/server/tests/fixtures/video_60fps_short.mp4 b/server/tests/fixtures/video_60fps_short.mp4 new file mode 100644 index 000000000..ff0593cf3 Binary files /dev/null and b/server/tests/fixtures/video_60fps_short.mp4 differ diff --git a/server/tests/fixtures/video_short-480.webm b/server/tests/fixtures/video_short-480.webm new file mode 100644 index 000000000..3145105e1 Binary files /dev/null and b/server/tests/fixtures/video_short-480.webm differ diff --git a/server/tests/fixtures/video_short.mp4 b/server/tests/fixtures/video_short.mp4 new file mode 100644 index 000000000..35678362b Binary files /dev/null and b/server/tests/fixtures/video_short.mp4 differ diff --git a/server/tests/fixtures/video_short.mp4.jpg b/server/tests/fixtures/video_short.mp4.jpg new file mode 100644 index 000000000..48790ffec Binary files /dev/null and b/server/tests/fixtures/video_short.mp4.jpg differ diff --git a/server/tests/fixtures/video_short.ogv b/server/tests/fixtures/video_short.ogv new file mode 100644 index 000000000..9e253da82 Binary files /dev/null and b/server/tests/fixtures/video_short.ogv differ diff --git a/server/tests/fixtures/video_short.ogv.jpg b/server/tests/fixtures/video_short.ogv.jpg new file mode 100644 index 000000000..c4c1d00e5 Binary files /dev/null and b/server/tests/fixtures/video_short.ogv.jpg differ diff --git a/server/tests/fixtures/video_short.webm b/server/tests/fixtures/video_short.webm new file mode 100644 index 000000000..bf4b0ab6c Binary files /dev/null and b/server/tests/fixtures/video_short.webm differ diff --git a/server/tests/fixtures/video_short.webm.jpg b/server/tests/fixtures/video_short.webm.jpg new file mode 100644 index 000000000..b0dffd099 Binary files /dev/null and b/server/tests/fixtures/video_short.webm.jpg differ diff --git a/server/tests/fixtures/video_short1-preview.webm.jpg b/server/tests/fixtures/video_short1-preview.webm.jpg new file mode 100644 index 000000000..d2a068b78 Binary files /dev/null and b/server/tests/fixtures/video_short1-preview.webm.jpg differ diff --git a/server/tests/fixtures/video_short1.webm b/server/tests/fixtures/video_short1.webm new file mode 100644 index 000000000..70ac0c644 Binary files /dev/null and b/server/tests/fixtures/video_short1.webm differ diff --git a/server/tests/fixtures/video_short1.webm.jpg b/server/tests/fixtures/video_short1.webm.jpg new file mode 100644 index 000000000..2db21975c Binary files /dev/null and b/server/tests/fixtures/video_short1.webm.jpg differ diff --git a/server/tests/fixtures/video_short2.webm b/server/tests/fixtures/video_short2.webm new file mode 100644 index 000000000..13d72dff7 Binary files /dev/null and b/server/tests/fixtures/video_short2.webm differ diff --git a/server/tests/fixtures/video_short2.webm.jpg b/server/tests/fixtures/video_short2.webm.jpg new file mode 100644 index 000000000..ed5952e04 Binary files /dev/null and b/server/tests/fixtures/video_short2.webm.jpg differ diff --git a/server/tests/fixtures/video_short3.webm b/server/tests/fixtures/video_short3.webm new file mode 100644 index 000000000..cde5dcd58 Binary files /dev/null and b/server/tests/fixtures/video_short3.webm differ diff --git a/server/tests/fixtures/video_short3.webm.jpg b/server/tests/fixtures/video_short3.webm.jpg new file mode 100644 index 000000000..b7c41cc1a Binary files /dev/null and b/server/tests/fixtures/video_short3.webm.jpg differ diff --git a/server/tests/fixtures/video_short_fake.webm b/server/tests/fixtures/video_short_fake.webm new file mode 100644 index 000000000..d85290ae5 --- /dev/null +++ b/server/tests/fixtures/video_short_fake.webm @@ -0,0 +1 @@ +this is a fake video mouahahah diff --git a/server/tests/utils/miscs/miscs.ts b/server/tests/utils/miscs/miscs.ts index 53cb67baf..5e46004a7 100644 --- a/server/tests/utils/miscs/miscs.ts +++ b/server/tests/utils/miscs/miscs.ts @@ -46,7 +46,7 @@ async function testImage (url: string, imageName: string, imagePath: string, ext const body = res.body - const data = await readFileBufferPromise(join(__dirname, '..', '..', 'api', 'fixtures', imageName + extension)) + const data = await readFileBufferPromise(join(__dirname, '..', '..', 'fixtures', imageName + extension)) const minLength = body.length - ((20 * body.length) / 100) const maxLength = body.length + ((20 * body.length) / 100) @@ -63,7 +63,7 @@ function buildAbsoluteFixturePath (path: string) { return path } - return join(__dirname, '..', '..', 'api', 'fixtures', path) + return join(__dirname, '..', '..', 'fixtures', path) } // --------------------------------------------------------------------------- diff --git a/server/tests/utils/requests/requests.ts b/server/tests/utils/requests/requests.ts index a9b1dff9a..b6195089d 100644 --- a/server/tests/utils/requests/requests.ts +++ b/server/tests/utils/requests/requests.ts @@ -1,5 +1,5 @@ import * as request from 'supertest' -import { buildAbsoluteFixturePath } from '../' +import { buildAbsoluteFixturePath } from '../miscs/miscs' function makeGetRequest (options: { url: string, diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts index d31e57a25..34d50f7ad 100644 --- a/server/tests/utils/users/users.ts +++ b/server/tests/utils/users/users.ts @@ -164,7 +164,7 @@ function updateMyAvatar (options: { if (isAbsolute(options.fixture)) { filePath = options.fixture } else { - filePath = join(__dirname, '..', '..', 'api', 'fixtures', options.fixture) + filePath = join(__dirname, '..', '..', 'fixtures', options.fixture) } return makeUploadRequest({ diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 746b5ca6b..ab0ce12ec 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -502,8 +502,6 @@ async function completeVideoCheck ( expect(dateIsValid(video.updatedAt)).to.be.true if (attributes.publishedAt) { - console.log(attributes.publishedAt) - console.log(video.publishedAt) expect(video.publishedAt).to.equal(attributes.publishedAt) }