aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-08-05 09:08:50 +0000
committerlain <lain@soykaf.club>2020-08-05 09:08:50 +0000
commit474aba984f2184d4f028c56f687d1a12f69d5c47 (patch)
tree0407edb9294937e374694e5b62dfedc415d5cc35 /test
parente8d10237da47f81bcb3837ac8b5d1b7cc7bf540c (diff)
parent184742af5eed2c48ba8518f1e114cbe0655ad467 (diff)
downloadpleroma-474aba984f2184d4f028c56f687d1a12f69d5c47.tar.gz
Merge branch 'unique-app-id' into 'develop'
Add unique index for apps.client_id, fixes #2022 Closes #2022 See merge request pleroma/pleroma!2844
Diffstat (limited to 'test')
-rw-r--r--test/web/oauth/app_test.exs11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/web/oauth/app_test.exs b/test/web/oauth/app_test.exs
index 899af648e..993a490e0 100644
--- a/test/web/oauth/app_test.exs
+++ b/test/web/oauth/app_test.exs
@@ -29,5 +29,16 @@ defmodule Pleroma.Web.OAuth.AppTest do
assert exist_app.id == app.id
assert exist_app.scopes == ["read", "write", "follow", "push"]
end
+
+ test "has unique client_id" do
+ insert(:oauth_app, client_name: "", redirect_uris: "", client_id: "boop")
+
+ error =
+ catch_error(insert(:oauth_app, client_name: "", redirect_uris: "", client_id: "boop"))
+
+ assert %Ecto.ConstraintError{} = error
+ assert error.constraint == "apps_client_id_index"
+ assert error.type == :unique
+ end
end
end