Last active
April 21, 2019 11:32
-
-
Save erez-rabih/0d6ac65055c4b218677fabccb7672572 to your computer and use it in GitHub Desktop.
user auth test with redis mock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftest get-user-by-token-test | |
(let [user-fix (db/insert users {:id 1 :name "username"})] | |
(testing "authorized token" | |
(redis/set "authorized-token" 1) | |
(testing "should return its respective user from the database" | |
(is (= user-fix (get-user-by-token "authorized-token"))))) | |
(testing "unauthorized token" | |
(testing "should return unauthorized" | |
(is (= :unauthorized (get-user-by-token "unauthorized-token"))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment