Add tests for signing functionality

Signed-off-by: Snorre Magnus Davøen's avatarSnorre Magnus Davøen <>
parent 4689c59f
Pipeline #19304 passed with stage
in 39 seconds
......@@ -85,3 +85,12 @@ vLu9XxKFHYlWPccluz3pqDfaGNPO12968DAldwvAV6hTGgx7oMaNPu0UltgD/aaj
(is (thrown? Exception
(with-redefs [clj-jwt/keystore (atom {})]
(clj-jwt/unsign (resource "jwks-other.json") signed-jwt))))))
(deftest sign-claims
(testing "Signs claims and return a valid jwt"
(is (= (with-redefs [clj-jwt/keystore (atom {"test-key" {:private-key ec-privkey}})]
(clj-jwt/sign (resource "jwks.json") "test-key" {:sub "foo"}))
(testing "Fails if given key-id not in jwks resource"
(is (thrown? Exception (with-redefs [clj-jwt/keystore (atom {"test-key" {:private-key ec-privkey}})]
(clj-jwt/sign (resource "jwks.json") "no-such-key" {:sub "foo"}))))))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment