summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2013-09-20 20:19:47 (GMT)
committerRemko Tronçon <git@el-tramo.be>2013-09-20 20:33:32 (GMT)
commit577c0c8fd30ffc0df718a8958eb7b8784ec3b0ac (patch)
tree95a7fabe2796cc2c234f0ab6f299ecdb4889d236 /Sluift/Tests
parent4a8cf892743284265bcc8bf9c6fbc4747aa86089 (diff)
downloadswift-577c0c8fd30ffc0df718a8958eb7b8784ec3b0ac.zip
swift-577c0c8fd30ffc0df718a8958eb7b8784ec3b0ac.tar.bz2
Sluift: Add convenient way for filling in forms
Change-Id: Ia265e8659e32f9e7a221d986625c830953a93ddc
Diffstat (limited to 'Sluift/Tests')
-rw-r--r--Sluift/Tests/FormTest.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/Sluift/Tests/FormTest.lua b/Sluift/Tests/FormTest.lua
index 813e05c..7b6b4af 100644
--- a/Sluift/Tests/FormTest.lua
+++ b/Sluift/Tests/FormTest.lua
@@ -44,8 +44,8 @@ example_form = [[
</field>
</x>]]
-form = sluift.from_xml(example_form)['data']
-print(form)
+form = sluift.from_xml(example_form)
+--print(form)
-- Test form properties
assert(form['title'] == 'Bot Configuration')
@@ -69,5 +69,11 @@ assert(form['features']['name'] == 'features')
assert(form['FORM_TYPE']['value'] == 'jabber:bot')
-- Test response form
-print(form:create_submission())
+submission = form:create_submission()
+assert(#(submission.fields) == 8)
+submission['description'] = 'my description'
+assert(submission['description']['value'] == 'my description')
+submission['type'] = 'cancel'
+assert(#(submission.fields) == 8)
+
--print(sluift.to_xml({type = 'form', data = form}))