 (def id    "test-id")
 (def attr  "test-attr")
 
-(ensure-table creds {:name       table
-                     :hash-key   {:name id :type :s}
-                     :throughput {:write 1 :read 1}})
+(defn setup-table!
+  []
+  (ensure-table creds {:name       table
+                       :hash-key   {:name id :type :s}
+                       :throughput {:write 1 :read 1}})
 
-(defn setup-table
-  []
   (batch-write-item creds
     [:delete table {id "1"}]
     [:delete table {id "2"}]

    (is (= nil (get-item creds table {id "4"})) "batch-write-item :delete failed")))

(deftest conditional-put
  (batch-write-item
   creds
   [:delete table {id "42"}]
   [:delete table {id "9"}]
   [:delete table {id "6"}]
   [:delete table {id "23"}])

  (batch-write-item
   creds
   [:put table {id "42" attr "foo"}]
   [:put table {id "6" attr "foobar"}]
   [:put table {id "9" attr "foobaz"}])

  ;; ;; Should update item 42 to have attr bar
  (put-item creds table {id "42" attr "bar"} :expected {attr "foo"})
  (is (= "bar" ((get-item creds table {id "42"}) attr)))


    [:put table {id "4" attr "foobar"}]))

(deftest test-batch-simple
  (setup-table!)

  (let [result
        (batch-get-item creds
          {table {:key-name "test-id"
                  :keys ["1" "2" "3" "4"]
                  :consistent true}})
        consis
        (batch-get-item creds
          {table {:key-name "test-id"
                  :keys ["1" "2" "3" "4"]
                  :consistent true}})
        attrs
        (batch-get-item creds
          {table {:key-name "test-id"
                  :keys ["1" "2" "3" "4"]
                  :consistent true
                  :attrs [attr]}})

        items  (get-in result [:responses table])
        item-1 (get-item creds table {id "1"})
