PageRenderTime 17ms CodeModel.GetById 12ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-3.0
  1. (in-package :oauth-test)
  2. (def-suite parameters :in oauth)
  3. (in-suite parameters)
  4. (test splice-alist/nil
  5. (is (null (oauth::splice-alist nil))))
  6. (test splice-alist/simple
  7. (is (equal (oauth::splice-alist '((a . 1)(b . 2)))
  8. '(a 1 b 2))))
  9. (test alist->query-string/nil
  10. (is (equal (oauth::alist->query-string nil) "")))
  11. (test alist->query-string/simple
  12. (is (equal (oauth::alist->query-string '(("foo" . 1) ("bar" . 2)))
  13. "&foo=1&bar=2")))
  14. (test alist->query-string/no-ampersand
  15. (is (equal (oauth::alist->query-string '(("foo" . 1) ("bar" . 2))
  16. :include-leading-ampersand nil)
  17. "foo=1&bar=2")))
  18. (test normalized-parameters/spec-example
  19. (let ((*post-parameters* '(("a" . "1")
  20. ("c" . "hi%20there")
  21. ("f" . "25")
  22. ("f" . "50")
  23. ("f" . "a")
  24. ("z" . "p")
  25. ("z" . "t"))))
  26. (is (equal
  27. (oauth::alist->query-string
  28. (oauth::normalized-parameters)
  29. :include-leading-ampersand nil)
  30. "a=1&c=hi%20there&f=25&f=50&f=a&z=p&z=t"))))