]> code.delx.au - gnu-emacs-elpa/blob - emacs-web-server-test.el
TODO: handle post data
[gnu-emacs-elpa] / emacs-web-server-test.el
1 ;;; emacs-web-server-test.el --- Test the Emacs Web Server
2
3 ;; Copyright (C) 2013 Eric Schulte <schulte.eric@gmail.com>
4
5 ;; Author: Eric Schulte <schulte.eric@gmail.com>
6 ;; License: GPLV3 (see the COPYING file in this directory)
7
8 ;;; TODO: fill in these tests, and then write more
9
10 ;;; Code:
11 (require 'emacs-web-server)
12 (require 'ert)
13
14 (ert-deftest ews/keyword-style-handler ()
15 "Ensure that a simple keyword-style handler matches correctly."
16 (should t) ; should match one
17 (should-not nil) ; should not match another
18 )
19
20 (ert-deftest ews/function-style-handler ()
21 "Ensure that a function-style handler matches correctly."
22 (should t) ; should match one
23 (should-not nil) ; should not match another
24 )
25
26 (ert-deftest ews/removed-from-ews-servers-after-stop ()
27 (should t))
28
29 (ert-deftest ews/parse-many-headers ()
30 "Test that a number of headers parse successfully."
31 (should t))
32
33 (ert-deftest ews/parse-post-data ()
34 (let ((post-header
35 "POST / HTTP/1.1
36 User-Agent: curl/7.33.0
37 Host: localhost:8080
38 Accept: */*
39 Content-Length: 273
40 Expect: 100-continue
41 Content-Type: multipart/form-data; boundary=----------------f1270d0deb77af03
42
43 ------------------f1270d0deb77af03
44 Content-Disposition: form-data; name=\"date\"
45
46 Wed Dec 18 00:55:39 MST 2013
47
48 ------------------f1270d0deb77af03
49 Content-Disposition: form-data; name=\"name\"
50
51 \"schulte\"
52 ------------------f1270d0deb77af03--
53 "))
54 (should 'properly-parse-post-data)))