Many AWS4 auth updates.
[zs3.git] / tests.lisp
blobf6094b080db014688d40e090f6459fca89128393
1 ;;;; tests.lisp
2 ;;;;
3 ;;;; This is for simple prerelase sanity testing, not general
4 ;;;; use. Please ignore.
6 (defpackage #:zs3-tests
7 (:use #:cl #:zs3))
9 (in-package #:zs3-tests)
11 (setf *credentials* (file-credentials "~/.aws"))
13 (defparameter *test-bucket* "zs3-tests33")
15 (when (bucket-exists-p *test-bucket*)
16 (delete-bucket *test-bucket*))
18 (create-bucket *test-bucket*)
20 (put-file "/etc/issue" *test-bucket* "printcap")
21 (put-string "Hello, world" *test-bucket* "hello")
22 (put-vector (octet-vector 8 6 7 5 3 0 9) *test-bucket* "jenny")
24 (all-buckets)
25 (all-keys *test-bucket*)
27 (delete-object *test-bucket* "printcap")
28 (delete-object *test-bucket* "hello")
29 (delete-object *test-bucket* "jenny")
31 (put-string "Hello, world" *test-bucket* "hello" :start 1 :end 5)
32 (string= (get-string *test-bucket* "hello")
33 (subseq "Hello, world" 1 5))
35 (put-file "tests.lisp" *test-bucket* "self" :start 1 :end 5)
36 (string= (get-string *test-bucket* "self")
37 ";;; ")
39 (defparameter *jenny* (octet-vector 8 6 7 5 3 0 9))
40 (put-vector *jenny* *test-bucket* "jenny" :start 1 :end 6)
42 (equalp (get-vector *test-bucket* "jenny")
43 (subseq *jenny* 1 6))
46 (delete-object *test-bucket* "hello")
47 (delete-object *test-bucket* "self")
48 (delete-object *test-bucket* "jenny")
51 ;;; Testing signing issues
53 (put-string "Slashdot" *test-bucket* "slash/dot")
54 (put-string "Tildedot" *test-bucket* "slash~dot")
55 (put-string "Spacedot" *test-bucket* "slash dot")
57 (delete-object *test-bucket* "slash/dot")
58 (delete-object *test-bucket* "slash~dot")
59 (delete-object *test-bucket* "slash dot")
61 ;;; Subresources
63 (put-string "Fiddle dee dee" *test-bucket* "fiddle")
64 (make-public :bucket *test-bucket* :key "fiddle")
65 (make-private :bucket *test-bucket* :key "fiddle")
66 (delete-object *test-bucket* "fiddle")
68 ;;; Different regions
70 (delete-bucket *test-bucket*)
72 (create-bucket *test-bucket* :location "eu-central-1")
73 (put-string "Hello, world" *test-bucket* "hello")
75 ;;; CloudFront distributions
77 (defparameter *distro*
78 (create-distribution *test-bucket*
79 :cnames "zs3-tests.cdn.wigflip.com"
80 :enabled nil
81 :comment "Testing, 1 2 3"))
83 (progn
84 (sleep 240)
85 (delete-distribution *distro*))
87 (delete-bucket *test-bucket*)