aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2020-08-03 22:32:51 -0500
committerAlex Gleason <alex@alexgleason.me>2020-08-04 13:31:40 -0500
commit184742af5eed2c48ba8518f1e114cbe0655ad467 (patch)
tree762cf4bc73399224b3f2258dd83c14224c3e7d4b /test
parente3953923aca1706ab508bfda1ab892304b29c09a (diff)
downloadpleroma-184742af5eed2c48ba8518f1e114cbe0655ad467.tar.gz
Unique apps.client_id for new installations, fixes #2022
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