tcgi.nim 619 B

123456789101112131415161718192021222324
  1. discard """
  2. output: '''
  3. [Suite] Test cgi module
  4. '''
  5. """
  6. import unittest
  7. import cgi, strtabs
  8. suite "Test cgi module":
  9. const queryString = "foo=bar&фу=бар&checked=✓&list=1,2,3&with_space=text%20with%20space"
  10. test "test query parsing with readData":
  11. let parsedQuery = readData(queryString)
  12. check parsedQuery["foo"] == "bar"
  13. check parsedQuery["фу"] == "бар"
  14. check parsedQuery["checked"] == "✓"
  15. check parsedQuery["list"] == "1,2,3"
  16. check parsedQuery["with_space"] == "text with space"
  17. expect KeyError:
  18. discard parsedQuery["not_existing_key"]