Move API endpoints to /api/v1/pleroma/backups
This commit is contained in:
parent
a9efd441e2
commit
17562bf414
3 changed files with 12 additions and 12 deletions
|
@ -616,7 +616,7 @@ Emoji reactions work a lot like favourites do. They make it possible to react to
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/backups`
|
## `POST /api/v1/pleroma/backups`
|
||||||
### Create a user backup archive
|
### Create a user backup archive
|
||||||
|
|
||||||
* Method: `POST`
|
* Method: `POST`
|
||||||
|
@ -635,7 +635,7 @@ Emoji reactions work a lot like favourites do. They make it possible to react to
|
||||||
}]
|
}]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/backups`
|
## `GET /api/v1/pleroma/backups`
|
||||||
### Lists user backups
|
### Lists user backups
|
||||||
|
|
||||||
* Method: `GET`
|
* Method: `GET`
|
||||||
|
|
|
@ -295,9 +295,6 @@ defmodule Pleroma.Web.Router do
|
||||||
get("/accounts/mfa/setup/:method", TwoFactorAuthenticationController, :setup)
|
get("/accounts/mfa/setup/:method", TwoFactorAuthenticationController, :setup)
|
||||||
post("/accounts/mfa/confirm/:method", TwoFactorAuthenticationController, :confirm)
|
post("/accounts/mfa/confirm/:method", TwoFactorAuthenticationController, :confirm)
|
||||||
delete("/accounts/mfa/:method", TwoFactorAuthenticationController, :disable)
|
delete("/accounts/mfa/:method", TwoFactorAuthenticationController, :disable)
|
||||||
|
|
||||||
get("/backups", BackupController, :index)
|
|
||||||
post("/backups", BackupController, :create)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/oauth", Pleroma.Web.OAuth do
|
scope "/oauth", Pleroma.Web.OAuth do
|
||||||
|
@ -358,6 +355,9 @@ defmodule Pleroma.Web.Router do
|
||||||
put("/mascot", MascotController, :update)
|
put("/mascot", MascotController, :update)
|
||||||
|
|
||||||
post("/scrobble", ScrobbleController, :create)
|
post("/scrobble", ScrobbleController, :create)
|
||||||
|
|
||||||
|
get("/backups", BackupController, :index)
|
||||||
|
post("/backups", BackupController, :create)
|
||||||
end
|
end
|
||||||
|
|
||||||
scope [] do
|
scope [] do
|
||||||
|
|
|
@ -14,14 +14,14 @@ defmodule Pleroma.Web.PleromaAPI.BackupControllerTest do
|
||||||
oauth_access(["read:accounts"])
|
oauth_access(["read:accounts"])
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /api/pleroma/backups", %{user: user, conn: conn} do
|
test "GET /api/v1/pleroma/backups", %{user: user, conn: conn} do
|
||||||
assert {:ok, %Oban.Job{args: %{"backup_id" => backup_id}}} = Backup.create(user)
|
assert {:ok, %Oban.Job{args: %{"backup_id" => backup_id}}} = Backup.create(user)
|
||||||
|
|
||||||
backup = Backup.get(backup_id)
|
backup = Backup.get(backup_id)
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/backups")
|
|> get("/api/v1/pleroma/backups")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert [
|
assert [
|
||||||
|
@ -45,11 +45,11 @@ test "GET /api/pleroma/backups", %{user: user, conn: conn} do
|
||||||
}
|
}
|
||||||
] =
|
] =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/backups")
|
|> get("/api/v1/pleroma/backups")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "POST /api/pleroma/backups", %{user: _user, conn: conn} do
|
test "POST /api/v1/pleroma/backups", %{user: _user, conn: conn} do
|
||||||
assert [
|
assert [
|
||||||
%{
|
%{
|
||||||
"content_type" => "application/zip",
|
"content_type" => "application/zip",
|
||||||
|
@ -60,7 +60,7 @@ test "POST /api/pleroma/backups", %{user: _user, conn: conn} do
|
||||||
}
|
}
|
||||||
] =
|
] =
|
||||||
conn
|
conn
|
||||||
|> post("/api/pleroma/backups")
|
|> post("/api/v1/pleroma/backups")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
Pleroma.Tests.ObanHelpers.perform_all()
|
Pleroma.Tests.ObanHelpers.perform_all()
|
||||||
|
@ -72,14 +72,14 @@ test "POST /api/pleroma/backups", %{user: _user, conn: conn} do
|
||||||
}
|
}
|
||||||
] =
|
] =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/backups")
|
|> get("/api/v1/pleroma/backups")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
days = Pleroma.Config.get([Backup, :limit_days])
|
days = Pleroma.Config.get([Backup, :limit_days])
|
||||||
|
|
||||||
assert %{"error" => "Last export was less than #{days} days ago"} ==
|
assert %{"error" => "Last export was less than #{days} days ago"} ==
|
||||||
conn
|
conn
|
||||||
|> post("/api/pleroma/backups")
|
|> post("/api/v1/pleroma/backups")
|
||||||
|> json_response_and_validate_schema(400)
|
|> json_response_and_validate_schema(400)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue