Remove one pod (#76)
[oweals/peertube.git] / server / tests / utils / users.js
index 8138074d014f7553ee60fc9e3cc28076a5e4b35a..310dc0c6b14e8c262daaf8b081f496d4e35e2a27 100644 (file)
@@ -4,6 +4,7 @@ const request = require('supertest')
 
 const usersUtils = {
   createUser,
+  registerUser,
   getUserInformation,
   getUserVideoRating,
   getUsersList,
@@ -36,6 +37,27 @@ function createUser (url, accessToken, username, password, specialStatus, end) {
     .end(end)
 }
 
+function registerUser (url, username, password, specialStatus, end) {
+  if (!end) {
+    end = specialStatus
+    specialStatus = 204
+  }
+
+  const path = '/api/v1/users/register'
+  const body = {
+    username,
+    password,
+    email: username + '@example.com'
+  }
+
+  request(url)
+    .post(path)
+    .set('Accept', 'application/json')
+    .send(body)
+    .expect(specialStatus)
+    .end(end)
+}
+
 function getUserInformation (url, accessToken, end) {
   const path = '/api/v1/users/me'