going somewhere
This commit is contained in:
1 parent
6e266c787b
commit
440206e924
15 files changed
+289
-46
No files matched your search
@@ -12,3 +12,4 @@
|
||||
ret {:skirmish.broker.user/accounts [{:skirmish.broker.account/id "foo"
|
||||
:skirmish.broker.account/url "http://localhost:1604/api/1/ledger/accounts/foo"}]}]
|
||||
(add-account-urls user) => ret)))
|
||||
|
||||
@@ -99,7 +99,14 @@
|
||||
request {:route-params {:sec-id :new-currency} :headers {"accept" "application/edn"}}
|
||||
resp ((get-security conn) request)]
|
||||
resp => (spec-check ::ok)
|
||||
(body resp) => {:sec-id :new-currency :interest-rate 100 :description nil :type nil :volume nil}))
|
||||
(body resp) => {:sec-id :new-currency
|
||||
:interest-rate 100
|
||||
:name nil
|
||||
:description nil
|
||||
:number-of-decimal nil
|
||||
:symbol nil
|
||||
:type nil
|
||||
:volume 0}))
|
||||
|
||||
(fact "we should not be able to get-security if it does not exists"
|
||||
(let [conn (create-conn)
|
||||
@@ -167,14 +174,14 @@
|
||||
req {:route-params {:account-id "2-sec-1"} :headers {"accept" "application/edn"}}]
|
||||
((get-account conn) req) => (spec-check ::ok)
|
||||
(body ((get-account conn) req)) => {:account {:account-public-key "2-sec-1" :amount 200 :sec-id :sec-1}
|
||||
:sec-url "/api/1/securities/sec-1"}))
|
||||
:sec-url "/api/1/ledger/securities/sec-1"}))
|
||||
|
||||
(fact "the interest should be payed when getting the account"
|
||||
(let [conn (create-some-securities-and-accounts (create-conn))
|
||||
req {:route-params {:account-id "2-sec-1"} :headers {"accept" "application/edn"}}]
|
||||
((get-account conn) req) => (spec-check ::ok)
|
||||
(body ((get-account conn) req)) => {:account {:account-public-key "2-sec-1" :amount 200 :sec-id :sec-1}
|
||||
:sec-url "/api/1/securities/sec-1"}))
|
||||
:sec-url "/api/1/ledger/securities/sec-1"}))
|
||||
|
||||
|
||||
(fact "we should not get an account if it does not exists"
|
||||
@@ -185,6 +192,7 @@
|
||||
|
||||
|
||||
;; TODO
|
||||
|
||||
;; 4. transfer sec from one account to the other.
|
||||
;; 5. account for interest
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
(ns skirmish.test-routes
|
||||
(:require [midje.sweet :refer :all]
|
||||
[skirmish.routes :refer :all]))
|
||||
|
||||
(def my-ledger-routes {
|
||||
:name :ledger
|
||||
:domain "http://localhost:1604" ;; should somehow be in some config
|
||||
:path "/api/1/ledger"
|
||||
:routes [{:name :home :path "/"}
|
||||
{:name :accounts :path "/accounts"}
|
||||
{:name :account :path "/accounts/:account-id"}]})
|
||||
|
||||
(def my-all-routes
|
||||
[my-ledger-routes])
|
||||
|
||||
|
||||
|
||||
(facts "About routes"
|
||||
(fact "it should be easy to get routes"
|
||||
(get-compojure-path my-all-routes :ledger/accounts) => "/accounts")
|
||||
|
||||
(fact "it should be able to retrieve routes"
|
||||
(get-path-for my-all-routes :ledger/accounts) => "/api/1/ledger/accounts"
|
||||
(get-path-for my-all-routes :ledger/account {:account-id "one-two"}) => "/api/1/ledger/accounts/one-two")
|
||||
|
||||
(fact "it should be able to retrieve the contect"
|
||||
(get-context my-all-routes :ledger) => "/api/1/ledger"))
|
||||
;;
|
||||
Reference in new issue
Block a user