aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_util_http.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2017-09-15 17:07:57 -0400
committerWaqas Hussain <waqas20@gmail.com>2017-09-15 17:07:57 -0400
commit67293fc09fea737de37a2fea7b211aa44695b5bf (patch)
treeb5cd2d09f0ee7e1e9e13feec26defe4f7d9f5003 /tests/test_util_http.lua
parent4c6c255113df008869577d4ec0291ff880b1273c (diff)
downloadprosody-67293fc09fea737de37a2fea7b211aa44695b5bf.tar.gz
prosody-67293fc09fea737de37a2fea7b211aa44695b5bf.zip
Port tests to the `busted` test runner
Diffstat (limited to 'tests/test_util_http.lua')
-rw-r--r--tests/test_util_http.lua41
1 files changed, 0 insertions, 41 deletions
diff --git a/tests/test_util_http.lua b/tests/test_util_http.lua
deleted file mode 100644
index d9cc2779..00000000
--- a/tests/test_util_http.lua
+++ /dev/null
@@ -1,41 +0,0 @@
--- Prosody IM
--- Copyright (C) 2008-2010 Matthew Wild
--- Copyright (C) 2008-2010 Waqas Hussain
---
--- This project is MIT/X11 licensed. Please see the
--- COPYING file in the source package for more information.
---
-
-function urlencode(urlencode)
- assert_equal(urlencode("helloworld123"), "helloworld123", "Normal characters not escaped");
- assert_equal(urlencode("hello world"), "hello%20world", "Spaces escaped");
- assert_equal(urlencode("This & that = something"), "This%20%26%20that%20%3d%20something", "Important URL chars escaped");
-end
-
-function urldecode(urldecode)
- assert_equal("helloworld123", urldecode("helloworld123"), "Normal characters not escaped");
- assert_equal("hello world", urldecode("hello%20world"), "Spaces escaped");
- assert_equal("This & that = something", urldecode("This%20%26%20that%20%3d%20something"), "Important URL chars escaped");
- assert_equal("This & that = something", urldecode("This%20%26%20that%20%3D%20something"), "Important URL chars escaped");
-end
-
-function formencode(formencode)
- assert_equal(formencode({ { name = "one", value = "1"}, { name = "two", value = "2" } }), "one=1&two=2", "Form encoded");
- assert_equal(formencode({ { name = "one two", value = "1"}, { name = "two one&", value = "2" } }), "one+two=1&two+one%26=2", "Form encoded");
-end
-
-function formdecode(formdecode)
- do
- local t = formdecode("one=1&two=2");
- assert_table(t[1]);
- assert_equal(t[1].name, "one"); assert_equal(t[1].value, "1");
- assert_table(t[2]);
- assert_equal(t[2].name, "two"); assert_equal(t[2].value, "2");
- end
-
- do
- local t = formdecode("one+two=1&two+one%26=2");
- assert_equal(t[1].name, "one two"); assert_equal(t[1].value, "1");
- assert_equal(t[2].name, "two one&"); assert_equal(t[2].value, "2");
- end
-end