Updated version to 1.3.3.
[zs3.git] / tests.lisp
blob42b9ba260153afa9af442e8d7c155692b3c93ed9
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 :public t)
44 (equalp (get-vector *test-bucket* "jenny")
45 (subseq *jenny* 1 6))
47 (drakma:http-request (resource-url :bucket *test-bucket* :key "jenny"))
49 (delete-object *test-bucket* "hello")
50 (delete-object *test-bucket* "self")
51 (delete-object *test-bucket* "jenny")
53 (put-string "Tildedot" *test-bucket* "slash~dot")
54 (put-string "Spacedot" *test-bucket* "slash dot")
56 (delete-object *test-bucket* "slash/dot")
57 (delete-object *test-bucket* "slash~dot")
58 (delete-object *test-bucket* "slash dot")
60 ;;; Subresources
62 (put-string "Fiddle dee dee" *test-bucket* "fiddle")
63 (make-public :bucket *test-bucket* :key "fiddle")
64 (make-private :bucket *test-bucket* :key "fiddle")
65 (delete-object *test-bucket* "fiddle")
67 ;;; Different regions
69 (delete-bucket *test-bucket*)
71 (create-bucket *test-bucket* :location "eu-central-1")
72 (put-string "Hello, world" *test-bucket* "hello")
74 ;;; CloudFront distributions
76 (defparameter *distro*
77 (create-distribution *test-bucket*
78 :cnames "zs3-tests.cdn.wigflip.com"
79 :enabled nil
80 :comment "Testing, 1 2 3"))
82 (progn
83 (sleep 240)
84 (delete-distribution *distro*))
86 (delete-bucket *test-bucket*)