diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-12 13:08:47 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-12 13:08:47 +0100 |
commit | 91cc839af88730ba55f84997c56b85ea100070a7 (patch) | |
tree | 2c9f5917370c3674e268234e76082f90c9244088 /server/tests/utils/videos.js | |
parent | 790e65fcf7a0a9f065ecc68c5982efb80cd2e1ca (diff) | |
download | PeerTube-91cc839af88730ba55f84997c56b85ea100070a7.tar.gz PeerTube-91cc839af88730ba55f84997c56b85ea100070a7.tar.zst PeerTube-91cc839af88730ba55f84997c56b85ea100070a7.zip |
Server: fix single pod tests
Diffstat (limited to 'server/tests/utils/videos.js')
-rw-r--r-- | server/tests/utils/videos.js | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js index beafd3cf5..f94368437 100644 --- a/server/tests/utils/videos.js +++ b/server/tests/utils/videos.js | |||
@@ -58,17 +58,25 @@ function getVideosList (url, end) { | |||
58 | .end(end) | 58 | .end(end) |
59 | } | 59 | } |
60 | 60 | ||
61 | function getVideosListPagination (url, start, count, end) { | 61 | function getVideosListPagination (url, start, count, sort, end) { |
62 | if (!end) { | ||
63 | end = sort | ||
64 | sort = null | ||
65 | } | ||
66 | |||
62 | const path = '/api/v1/videos' | 67 | const path = '/api/v1/videos' |
63 | 68 | ||
64 | request(url) | 69 | const req = request(url) |
65 | .get(path) | 70 | .get(path) |
66 | .query({ start: start }) | 71 | .query({ start: start }) |
67 | .query({ count: count }) | 72 | .query({ count: count }) |
68 | .set('Accept', 'application/json') | 73 | |
69 | .expect(200) | 74 | if (sort) req.query({ sort }) |
70 | .expect('Content-Type', /json/) | 75 | |
71 | .end(end) | 76 | req.set('Accept', 'application/json') |
77 | .expect(200) | ||
78 | .expect('Content-Type', /json/) | ||
79 | .end(end) | ||
72 | } | 80 | } |
73 | 81 | ||
74 | function getVideosListSort (url, sort, end) { | 82 | function getVideosListSort (url, sort, end) { |
@@ -116,18 +124,26 @@ function searchVideo (url, search, field, end) { | |||
116 | .end(end) | 124 | .end(end) |
117 | } | 125 | } |
118 | 126 | ||
119 | function searchVideoWithPagination (url, search, field, start, count, end) { | 127 | function searchVideoWithPagination (url, search, field, start, count, sort, end) { |
128 | if (!end) { | ||
129 | end = sort | ||
130 | sort = null | ||
131 | } | ||
132 | |||
120 | const path = '/api/v1/videos' | 133 | const path = '/api/v1/videos' |
121 | 134 | ||
122 | request(url) | 135 | const req = request(url) |
123 | .get(path + '/search/' + search) | 136 | .get(path + '/search/' + search) |
124 | .query({ start: start }) | 137 | .query({ start: start }) |
125 | .query({ count: count }) | 138 | .query({ count: count }) |
126 | .query({ field: field }) | 139 | .query({ field: field }) |
127 | .set('Accept', 'application/json') | 140 | |
128 | .expect(200) | 141 | if (sort) req.query({ sort }) |
129 | .expect('Content-Type', /json/) | 142 | |
130 | .end(end) | 143 | req.set('Accept', 'application/json') |
144 | .expect(200) | ||
145 | .expect('Content-Type', /json/) | ||
146 | .end(end) | ||
131 | } | 147 | } |
132 | 148 | ||
133 | function searchVideoWithSort (url, search, sort, end) { | 149 | function searchVideoWithSort (url, search, sort, end) { |