mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Add user role checks, see #14
Squashed commit of the following:
commit 393c481a21fa97881be2b6859e9acaa8ab7abb7f
Author: Arne Schlüter <arne@schlueter.is>
Date: Wed Sep 5 12:04:56 2018 +0200
Consider user roles when building up the navigation
commit d631cba1174ecf42b682664bf57c41b88b7f5ed4
Author: Arne Schlüter <arne@schlueter.is>
Date: Wed Sep 5 11:52:05 2018 +0200
Save user roles on login
commit e68ced335ccc11a2daebbf12bb4061a53935c268
Author: Arne Schlüter <arne@schlueter.is>
Date: Wed Sep 5 10:25:19 2018 +0200
Rename dispatch to muted-dispatch for easier disambiguation
This commit is contained in:
parent
3b58648b82
commit
5cbb83a22d
12 changed files with 180 additions and 53 deletions
|
|
@ -6,7 +6,8 @@
|
|||
[airsonic-ui.db :as db]
|
||||
[airsonic-ui.routes :as routes]
|
||||
[airsonic-ui.events :as events]
|
||||
[airsonic-ui.subs :as subs]))
|
||||
[airsonic-ui.subs :as subs]
|
||||
))
|
||||
|
||||
(enable-console-print!)
|
||||
|
||||
|
|
@ -53,10 +54,11 @@
|
|||
request (:http-xhrio fx)]
|
||||
(testing "uses correct server url"
|
||||
(let [uri (:uri request)]
|
||||
(is (true? (str/starts-with? uri (:server fixtures/credentials))))
|
||||
(is (true? (str/includes? uri "/ping")))
|
||||
(is (true? (str/includes? uri (str "p=" (:p fixtures/credentials)))))
|
||||
(is (true? (str/includes? uri (str "u=" (:u fixtures/credentials)))))))
|
||||
(is (str/starts-with? uri (:server fixtures/credentials)))
|
||||
(is (str/includes? uri "/getUser"))
|
||||
(is (str/includes? uri (str "p=" (:p fixtures/credentials))))
|
||||
(is (str/includes? uri (str "u=" (:u fixtures/credentials))))
|
||||
(is (str/includes? uri (str "username=" (:u fixtures/credentials))))))
|
||||
(testing "invokes correct callback on server response"
|
||||
(is (= [:credentials/authentication-response fixtures/credentials] (:on-success request))))
|
||||
(testing "invokes correct callback when server is not reachable"
|
||||
|
|
@ -66,9 +68,12 @@
|
|||
(testing "On success"
|
||||
(let [cofx (-> (has-previous-session)
|
||||
(events/authentication-response [:credentials/authentication-response (:auth-success fixtures/responses)])
|
||||
(events/authentication-success [:credentials/authentication-success]))]
|
||||
(events/authentication-success [:credentials/authentication-success fixtures/credentials (:auth-success fixtures/responses)]))]
|
||||
(testing "should mark the credentials as verified"
|
||||
(is (true? (get-in cofx [:db :credentials :verified?]))))))
|
||||
(is (true? (get-in cofx [:db :credentials :verified?]))))
|
||||
(testing "should store the credentials in localstorage"
|
||||
(let [stored-credentials (get-in cofx [:store :credentials])]
|
||||
(is (= fixtures/credentials stored-credentials))))))
|
||||
(testing "On failure"
|
||||
(let [cofx (-> (has-previous-session)
|
||||
(events/authentication-response [:credentials/authentication-response (:auth-failure fixtures/responses)])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue