1 ! Copyright (C) 2009 Elie Chaftari.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: concurrency.promises namespaces kernel pop3 pop3.server
4 sequences tools.test accessors calendar ;
6 FROM: pop3 => count delete ;
10 { } [ "p1" get mock-pop3-server ] unit-test
14 "p1" get 5 seconds ?promise-timeout >>port
17 { } [ "username@host.com" >user ] unit-test
18 { } [ "password" >pwd ] unit-test
19 { { "CAPA" "TOP" "UIDL" } } [ capa ] unit-test
20 { 2 } [ count ] unit-test
21 { H{ { 1 "1006" } { 2 "747" } } } [ list ] unit-test
24 { "From:" "from.first@mail.com" }
25 { "Subject:" "First test with mock POP3 server" }
26 { "To:" "username@host.com" }
28 } [ 1 0 top drop headers ] unit-test
33 { uidl "000000d547ac2fc2" }
34 { from "from.first@mail.com" }
35 { to "username@host.com" }
36 { subject "First test with mock POP3 server" }
41 { uidl "000000d647ac2fc2" }
42 { from "from.second@mail.com" }
43 { to "username@host.com" }
44 { subject "Second test with mock POP3 server" }
48 } [ consolidate ] unit-test
49 { "000000d547ac2fc2" } [ 1 uidl ] unit-test
50 { } [ 1 delete ] unit-test
51 { } [ reset ] unit-test
52 { } [ close ] unit-test
57 { } [ "p2" get mock-pop3-server ] unit-test
61 "p2" get 5 seconds ?promise-timeout >>port
62 "username@host.com" >>user
66 { f } [ 1 retrieve empty? ] unit-test
67 { } [ close ] unit-test