]> Untitled Git - lemmy.git/blobdiff - api_tests/src/shared.ts
Revert "Add pending, and change use specific API response for FollowCommunity…" ...
[lemmy.git] / api_tests / src / shared.ts
index 8c4e08ff4f717cc60bf507ed18383e2a1696acda..d5be61ac3f66e4164fd05cd780a5a01838170378 100644 (file)
@@ -50,7 +50,6 @@ import {
   ResolveObjectResponse,
   ResolveObject,
   CreatePostReport,
-  PostReport,
   ListPostReports,
   PostReportResponse,
   ListPostReportsResponse,
@@ -58,6 +57,8 @@ import {
   CommentReportResponse,
   ListCommentReports,
   ListCommentReportsResponse,
+  DeleteAccount,
+  DeleteAccountResponse
 } from 'lemmy-js-client';
 
 export interface API {
@@ -131,6 +132,13 @@ export async function setupLogins() {
   gamma.auth = res[2].jwt;
   delta.auth = res[3].jwt;
   epsilon.auth = res[4].jwt;
+
+  // regstration applications are now enabled by default, need to disable them
+  await alpha.client.editSite({ require_application: false, auth: alpha.auth});
+  await beta.client.editSite({ require_application: false, auth: beta.auth});
+  await gamma.client.editSite({ require_application: false, auth: gamma.auth});
+  await delta.client.editSite({ require_application: false, auth: delta.auth});
+  await epsilon.client.editSite({ require_application: false, auth: epsilon.auth});
 }
 
 export async function createPost(
@@ -427,14 +435,10 @@ export async function createCommunity(
   name_: string = randomString(5)
 ): Promise<CommunityResponse> {
   let description = 'a sample description';
-  let icon = 'https://image.flaticon.com/icons/png/512/35/35896.png';
-  let banner = 'https://image.flaticon.com/icons/png/512/35/35896.png';
   let form: CreateCommunity = {
     name: name_,
     title: name_,
     description,
-    icon,
-    banner,
     nsfw: false,
     auth: api.auth,
   };
@@ -553,6 +557,16 @@ export async function saveUserSettings(
   return api.client.saveUserSettings(form);
 }
 
+export async function deleteUser(
+  api: API,
+): Promise<DeleteAccountResponse> {
+  let form: DeleteAccount = {
+    auth: api.auth,
+    password
+  };
+  return api.client.deleteAccount(form);
+}
+
 export async function getSite(
   api: API
 ): Promise<GetSiteResponse> {
@@ -657,3 +671,10 @@ export function randomString(length: number): string {
   }
   return result;
 }
+
+export async function unfollows() {
+  await unfollowRemotes(alpha);
+  await unfollowRemotes(gamma);
+  await unfollowRemotes(delta);
+  await unfollowRemotes(epsilon);
+}