Skip to content
Snippets Groups Projects
Commit 015965f1 authored by Tom Robinson's avatar Tom Robinson
Browse files

Merge branch 'segments' of github.com:metabase/metabase into segments

parents b014ff83 e3017df6
Branches
Tags
No related merge requests found
......@@ -25,11 +25,11 @@
(->500 (segment/create-segment table_id name description *current-user-id* definition)))
;(defendpoint GET "/:id"
; "Fetch `Segment` with ID."
; [id]
; (check-superuser)
; (->404 (segment/retrieve-segment id)))
(defendpoint GET "/:id"
"Fetch `Segment` with ID."
[id]
(check-superuser)
(->404 (segment/retrieve-segment id)))
(defendpoint PUT "/:id"
......
......@@ -156,3 +156,26 @@
;; ## GET /api/segment/:id
(expect
{:name "One Segment to rule them all, one segment to define them"
:description "One segment to bring them all, and in the DataModel bind them"
:creator_id (user->id :crowberto)
:creator (user-details (fetch-user :crowberto))
:created_at true
:updated_at true
:definition {:database 123
:query {:filter ["In the Land of Metabase where the Datas lie"]}}}
(tu/with-temp Database [{database-id :id} {:name "Hillbilly"
:engine :yeehaw
:details {}
:is_sample false}]
(tu/with-temp Table [{table-id :id} {:name "Stuff"
:db_id database-id
:active true}]
(tu/with-temp Segment [{:keys [id]} {:creator_id (user->id :crowberto)
:table_id table-id
:name "One Segment to rule them all, one segment to define them"
:description "One segment to bring them all, and in the DataModel bind them"
:definition {:database 123
:query {:filter ["In the Land of Metabase where the Datas lie"]}}}]
(segment-response ((user->client :crowberto) :get 200 (format "segment/%d" id)))))))
......@@ -109,3 +109,5 @@
:table_id 456
:definition {:database 2
:query {:filter ["not" "the droids you're looking for"]}}} "Just horsing around")))))
;; TODO: delete-segment
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment