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 ;
7 FROM: pop3 => count delete ;
11 [ ] [ "p1" get mock-pop3-server ] unit-test
15 "p1" get 5 seconds ?promise-timeout >>port
18 [ ] [ "username@host.com" >user ] unit-test
19 [ ] [ "password" >pwd ] unit-test
20 [ { "CAPA" "TOP" "UIDL" } ] [ capa ] unit-test
21 [ 2 ] [ count ] unit-test
22 [ H{ { 1 "1006" } { 2 "747" } } ] [ list ] unit-test
25 { "From:" "from.first@mail.com" }
26 { "Subject:" "First test with mock POP3 server" }
27 { "To:" "username@host.com" }
29 ] [ 1 0 top drop headers ] unit-test
34 { uidl "000000d547ac2fc2" }
35 { from "from.first@mail.com" }
36 { to "username@host.com" }
37 { subject "First test with mock POP3 server" }
42 { uidl "000000d647ac2fc2" }
43 { from "from.second@mail.com" }
44 { to "username@host.com" }
45 { subject "Second test with mock POP3 server" }
49 ] [ consolidate ] unit-test
50 [ "000000d547ac2fc2" ] [ 1 uidl ] unit-test
51 [ ] [ 1 delete ] unit-test
52 [ ] [ reset ] unit-test
53 [ ] [ close ] unit-test
58 [ ] [ "p2" get mock-pop3-server ] unit-test
62 "p2" get 5 seconds ?promise-timeout >>port
63 "username@host.com" >>user
67 [ f ] [ 1 retrieve empty? ] unit-test
68 [ ] [ close ] unit-test