forgot a few
This commit is contained in:
parent
aec0ccfe41
commit
cbeae300d9
|
@ -21,28 +21,28 @@
|
||||||
(deftest vexec-runs-query-and-puts-hints
|
(deftest vexec-runs-query-and-puts-hints
|
||||||
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL)"]
|
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL)"]
|
||||||
result (vexec! test-view-system test-db sqlvec)]
|
result (vexec! test-view-system test-db sqlvec)]
|
||||||
(is (= [test-db sqlvec] (:jdbc/execute! @redefs-called)))
|
(is (called-with-args? :jdbc/execute! test-db sqlvec))
|
||||||
(is (= :jdbc/execute!-return-value result))
|
(is (= :jdbc/execute!-return-value result))
|
||||||
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:example} hint-type)]))))
|
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:example} hint-type)]))))
|
||||||
|
|
||||||
(deftest vexec-runs-query-with-returning-clause
|
(deftest vexec-runs-query-with-returning-clause
|
||||||
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL) RETURNING *"]
|
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL) RETURNING *"]
|
||||||
result (vexec! test-view-system test-db sqlvec)]
|
result (vexec! test-view-system test-db sqlvec)]
|
||||||
(is (= [test-db sqlvec] (:jdbc/query @redefs-called)))
|
(is (called-with-args? :jdbc/query test-db sqlvec))
|
||||||
(is (= :jdbc/query-return-value result))
|
(is (= :jdbc/query-return-value result))
|
||||||
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:example} hint-type)]))))
|
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:example} hint-type)]))))
|
||||||
|
|
||||||
(deftest namespace-is-passed-along-to-hints-via-vexec
|
(deftest namespace-is-passed-along-to-hints-via-vexec
|
||||||
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL)"]
|
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL)"]
|
||||||
result (vexec! test-view-system test-db sqlvec {:namespace :foobar})]
|
result (vexec! test-view-system test-db sqlvec {:namespace :foobar})]
|
||||||
(is (= [test-db sqlvec] (:jdbc/execute! @redefs-called)))
|
(is (called-with-args? :jdbc/execute! test-db sqlvec))
|
||||||
(is (= :jdbc/execute!-return-value result))
|
(is (= :jdbc/execute!-return-value result))
|
||||||
(is (called-with-args? :views/put-hints! test-view-system [(views/hint :foobar #{:example} hint-type)]))))
|
(is (called-with-args? :views/put-hints! test-view-system [(views/hint :foobar #{:example} hint-type)]))))
|
||||||
|
|
||||||
(deftest manually-provided-hints-to-vexec-are-passed-to-views-system
|
(deftest manually-provided-hints-to-vexec-are-passed-to-views-system
|
||||||
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL)"]
|
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL)"]
|
||||||
result (vexec! test-view-system test-db sqlvec [:foo :bar])]
|
result (vexec! test-view-system test-db sqlvec [:foo :bar])]
|
||||||
(is (= [test-db sqlvec] (:jdbc/execute! @redefs-called)))
|
(is (called-with-args? :jdbc/execute! test-db sqlvec))
|
||||||
(is (= :jdbc/execute!-return-value result))
|
(is (= :jdbc/execute!-return-value result))
|
||||||
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:foo :bar} hint-type)]))))
|
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:foo :bar} hint-type)]))))
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
result (vexec! test-view-system test-db sqlvec [:foo :bar])]
|
result (vexec! test-view-system test-db sqlvec [:foo :bar])]
|
||||||
; means jdbc/execute! was called which is correct behaviour since the returning option was not specified.
|
; means jdbc/execute! was called which is correct behaviour since the returning option was not specified.
|
||||||
; if jdbc/execute! was really called it would throw an exception since the INSERT query used has a RETURNING clause
|
; if jdbc/execute! was really called it would throw an exception since the INSERT query used has a RETURNING clause
|
||||||
(is (= [test-db sqlvec] (:jdbc/execute! @redefs-called)))
|
(is (called-with-args? :jdbc/execute! test-db sqlvec))
|
||||||
(is (= :jdbc/execute!-return-value result))
|
(is (= :jdbc/execute!-return-value result))
|
||||||
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:foo :bar} hint-type)])))
|
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:foo :bar} hint-type)])))
|
||||||
; manually reset some things
|
; manually reset some things
|
||||||
|
@ -59,6 +59,6 @@
|
||||||
(reset! query-info-cache {})
|
(reset! query-info-cache {})
|
||||||
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL) RETURNING *"]
|
(let [sqlvec ["INSERT INTO example (field1, field2, field3) VALUES ('test', 'N', NULL) RETURNING *"]
|
||||||
result (vexec! test-view-system test-db sqlvec [:foo :bar] {:returning? true})]
|
result (vexec! test-view-system test-db sqlvec [:foo :bar] {:returning? true})]
|
||||||
(is (= [test-db sqlvec] (:jdbc/query @redefs-called)))
|
(is (called-with-args? :jdbc/query test-db sqlvec))
|
||||||
(is (= :jdbc/query-return-value result))
|
(is (= :jdbc/query-return-value result))
|
||||||
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:foo :bar} hint-type)]))))
|
(is (called-with-args? :views/put-hints! test-view-system [(views/hint nil #{:foo :bar} hint-type)]))))
|
||||||
|
|
Loading…
Reference in a new issue