Skip to content

Instantly share code, notes, and snippets.

@erez-rabih
Created June 3, 2019 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erez-rabih/056f780080c3e02e48ffabc9bac86b6d to your computer and use it in GitHub Desktop.
Save erez-rabih/056f780080c3e02e48ffabc9bac86b6d to your computer and use it in GitHub Desktop.
tighter mock
(deftest get-file-metadata-test
(let [example-bucket "some-bucket"
example-filename "some-file"
example-metadata {:example "valid metadata"}]
(testing "should return file metadata in case file exists"
(with-redefs [s3/get-object (fn [& {:keys [bucket-name key]}]
(when (and
(= bucket-name example-bucket)
(= key example-filename))
example-metadata))]
(is (= example-metadata (get-file-metadata example-bucket example-filename)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment