Initial ftp test cases
This commit is contained in:
parent
52281d7089
commit
15d9a7dd8a
29
collects/tests/net/ftp.rkt
Normal file
29
collects/tests/net/ftp.rkt
Normal file
|
@ -0,0 +1,29 @@
|
|||
#lang racket
|
||||
(require net/ftp tests/eli-tester)
|
||||
|
||||
(define server "ftp.gnu.org")
|
||||
(define port 21)
|
||||
(define user "anonymous")
|
||||
(define passwd "nonny")
|
||||
|
||||
(provide tests)
|
||||
(define (tests)
|
||||
(define conn #f)
|
||||
(define pth "=README-about-.diff-files")
|
||||
(define tmp-dir (make-temporary-file "ftp~a" 'directory))
|
||||
(test (ftp-connection? 1) => #f
|
||||
(set! conn (ftp-establish-connection server port user passwd))
|
||||
(ftp-connection? conn)
|
||||
(ftp-cd conn "gnu")
|
||||
(for ([f (in-list (ftp-directory-list conn))])
|
||||
(match-define (list type ftp-date name) f)
|
||||
(test
|
||||
(ftp-make-file-seconds ftp-date)))
|
||||
|
||||
(ftp-download-file conn tmp-dir pth)
|
||||
(delete-file (build-path tmp-dir pth))
|
||||
(delete-directory/files tmp-dir)
|
||||
|
||||
(ftp-close-connection conn)))
|
||||
|
||||
(tests)
|
|
@ -4,6 +4,7 @@
|
|||
(prefix-in ucodec: "uri-codec.rkt")
|
||||
(prefix-in url: "url.rkt")
|
||||
(prefix-in cgi: "cgi.rkt")
|
||||
(prefix-in ftp: "ftp.rkt")
|
||||
(prefix-in head: "head.rkt")
|
||||
(prefix-in cookie: "cookie.rkt")
|
||||
(prefix-in encoders: "encoders.rkt"))
|
||||
|
@ -12,6 +13,7 @@
|
|||
(test do (begin (url:tests)
|
||||
(ucodec:tests)
|
||||
(cgi:tests)
|
||||
(ftp:tests)
|
||||
(head:tests)
|
||||
(cookie:tests)
|
||||
(encoders:tests))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user