#10: fixes bug 10, all tests pass, no regression expected.
This commit is contained in:
parent
b472bd4950
commit
69ead0f5eb
|
@ -320,7 +320,8 @@
|
|||
(let [view-name (safe-name (str "lv_" (:table (:attrs entity))) :sql)
|
||||
entity-properties (filter
|
||||
#(= (:type (:attrs %)) "entity")
|
||||
(properties entity))]
|
||||
(properties entity))
|
||||
tn (safe-name (-> entity :attrs :table) :sql)]
|
||||
(s/join
|
||||
"\n"
|
||||
(remove
|
||||
|
@ -345,8 +346,8 @@
|
|||
(= (:type (:attrs %)) "entity")
|
||||
(list
|
||||
(emit-convenience-entity-field % entity application (field-name %))
|
||||
(str (safe-name entity) "." (field-name %)))
|
||||
(str (safe-name entity) "." (field-name %)))
|
||||
(str tn "." (field-name %)))
|
||||
(str tn "." (field-name %)))
|
||||
(remove
|
||||
#(#{"link" "list"} (:type (:attrs %)))
|
||||
(all-properties entity) ))))))
|
||||
|
|
|
@ -493,6 +493,56 @@
|
|||
should-not-find #"animal.name AS dam_expanded"]
|
||||
;; (print actual) ;; see what we've got
|
||||
(is (re-find should-find actual))
|
||||
(is (nil? (re-find should-not-find actual))))
|
||||
(is (nil? (re-find should-not-find actual)))))))
|
||||
|
||||
)))
|
||||
(deftest bug-10-test
|
||||
(testing "Correct table names in convenience view select queries
|
||||
see [bug 10](https://github.com/simon-brooke/adl/issues/10)"
|
||||
(let [app
|
||||
{:tag :application,
|
||||
:attrs {:version "0.0.1",
|
||||
:name "pastoralist",
|
||||
:xmlns:adl "http://bowyer.journeyman.cc/adl/1.4.1/",
|
||||
:xmlns:html "http://www.w3.org/1999/xhtml",
|
||||
:xmlns "http://bowyer.journeyman.cc/adl/1.4.1/"},
|
||||
:content [{:tag :documentation,
|
||||
:attrs nil,
|
||||
:content ["A web-app intended to be used by pastoralists in managing
|
||||
pastures, grazing, and animals."]}
|
||||
{:tag :entity,
|
||||
:attrs
|
||||
{:volatility "5",
|
||||
:magnitude "3",
|
||||
:name "event-type",
|
||||
:table "event-type"},
|
||||
:content
|
||||
[{:tag :key,
|
||||
:attrs nil,
|
||||
:content
|
||||
[{:tag :property,
|
||||
:attrs
|
||||
{:distinct "system",
|
||||
:immutable "true",
|
||||
:column "id",
|
||||
:name "id",
|
||||
:type "integer",
|
||||
:required "true"},
|
||||
:content
|
||||
[{:tag :generator, :attrs {:action "native"}, :content nil}]}]}
|
||||
{:tag :property,
|
||||
:attrs {:size "80", :type "string", :name "summary"},
|
||||
:content nil}
|
||||
{:tag :property,
|
||||
:attrs {:type "text", :name "description"},
|
||||
:content nil}
|
||||
{:tag :property,
|
||||
:attrs {:default "1", :type "integer", :name "n-holdings"},}
|
||||
{:tag :property,
|
||||
:attrs {:default "1", :type "integer", :name "n-pastures"}}
|
||||
{:tag :property,
|
||||
:attrs {:default "1", :type "integer", :name "n-animals"}}]}]}
|
||||
should-find #"event_type.description"
|
||||
should-not-find #"event-type.description"
|
||||
actual (emit-convenience-view (child app #(= (-> % :attrs :name) "event-type")) app)]
|
||||
(is (re-find should-find actual))
|
||||
(is (nil? (re-find should-not-find actual))))))
|
||||
|
|
Loading…
Reference in a new issue