Update encoding of + to match Amazon's behavior.
[zs3.git] / tests.lisp
blob981401fee46fe14a8dad9e34b46973d9e7ed1f0a
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-string "Plus good" *test-bucket* "plus+good")
23 (put-vector (octet-vector 8 6 7 5 3 0 9) *test-bucket* "jenny")
25 (all-buckets)
26 (all-keys *test-bucket*)
28 (delete-object *test-bucket* "printcap")
29 (delete-object *test-bucket* "hello")
30 (delete-object *test-bucket* "plus+good")
31 (delete-object *test-bucket* "jenny")
33 (put-string "Hello, world" *test-bucket* "hello" :start 1 :end 5)
34 (string= (get-string *test-bucket* "hello")
35 (subseq "Hello, world" 1 5))
37 (put-file "tests.lisp" *test-bucket* "self" :start 1 :end 5)
38 (string= (get-string *test-bucket* "self")
39 ";;; ")
41 (defparameter *jenny* (octet-vector 8 6 7 5 3 0 9))
42 (put-vector *jenny* *test-bucket* "jenny" :start 1 :end 6)
44 (equalp (get-vector *test-bucket* "jenny")
45 (subseq *jenny* 1 6))
48 (delete-object *test-bucket* "hello")
49 (delete-object *test-bucket* "self")
50 (delete-object *test-bucket* "jenny")
53 ;;; Testing signing issues
55 (put-string "Slashdot" *test-bucket* "slash/dot")
56 (put-string "Tildedot" *test-bucket* "slash~dot")
57 (put-string "Spacedot" *test-bucket* "slash dot")
59 (delete-object *test-bucket* "slash/dot")
60 (delete-object *test-bucket* "slash~dot")
61 (delete-object *test-bucket* "slash dot")
63 ;;; Subresources
65 (put-string "Fiddle dee dee" *test-bucket* "fiddle")
66 (make-public :bucket *test-bucket* :key "fiddle")
67 (make-private :bucket *test-bucket* :key "fiddle")
68 (delete-object *test-bucket* "fiddle")
70 ;;; Different regions
72 (delete-bucket *test-bucket*)
74 (create-bucket *test-bucket* :location "eu-central-1")
75 (put-string "Hello, world" *test-bucket* "hello")
77 ;;; CloudFront distributions
79 (defparameter *distro*
80 (create-distribution *test-bucket*
81 :cnames "zs3-tests.cdn.wigflip.com"
82 :enabled nil
83 :comment "Testing, 1 2 3"))
85 (progn
86 (sleep 240)
87 (delete-distribution *distro*))
89 (delete-bucket *test-bucket*)