PageRenderTime 202ms CodeModel.GetById 100ms app.highlight 3ms RepoModel.GetById 98ms app.codeStats 0ms

/test/core/parameters.lisp

http://github.com/skypher/cl-oauth
Lisp | 40 lines | 30 code | 10 blank | 0 comment | 0 complexity | c8994a503aaf737e30498a60a9ef91ad MD5 | raw file
 1
 2(in-package :oauth-test)
 3
 4(def-suite parameters :in oauth)
 5
 6(in-suite parameters)
 7
 8(test splice-alist/nil
 9  (is (null (oauth::splice-alist nil))))
10
11(test splice-alist/simple
12  (is (equal (oauth::splice-alist '((a . 1)(b . 2)))
13             '(a 1 b 2))))
14
15(test alist->query-string/nil
16  (is (equal (oauth::alist->query-string nil) "")))
17
18(test alist->query-string/simple
19  (is (equal (oauth::alist->query-string '(("foo" . 1) ("bar" . 2)))
20             "&foo=1&bar=2")))
21
22(test alist->query-string/no-ampersand
23  (is (equal (oauth::alist->query-string '(("foo" . 1) ("bar" . 2))
24                                  :include-leading-ampersand nil)
25             "foo=1&bar=2")))
26
27(test normalized-parameters/spec-example
28  (let ((*post-parameters* '(("a" . "1")
29                             ("c" . "hi%20there")
30                             ("f" . "25")
31                             ("f" . "50")
32                             ("f" . "a")
33                             ("z" . "p")
34                             ("z" . "t"))))
35    (is (equal
36          (oauth::alist->query-string
37            (oauth::normalized-parameters)
38            :include-leading-ampersand nil)
39          "a=1&c=hi%20there&f=25&f=50&f=a&z=p&z=t"))))
40