                                                         :with-job? true
                                                         :data data})
         dataset-id (:dataset_id job)
+        dataset    (last (ds/fetch-metadata conn dataset-id))
         data-source-id (:data_source_id job)]
 
     (upsert-visualisation conn (merge vis-spec {:dataset-id dataset-id}))
-    {:visualisation-id (:id vis-spec) :dataset-id dataset-id :data-source-id data-source-id}))
+    {:visualisation-id (:id vis-spec) :dataset-id dataset-id :data-source-id data-source-id :dataset dataset}))
 
 (defn seed
   [conn spec]
-  (seed* conn (:vis-1 spec))
-  (seed* conn (:vis-2 spec))
-  (dashboard/create conn (dashboard-spec (:id (:vis-1 spec))
-                                         (:id (:vis-2 spec))) {}))
+  (let [res1 (seed* conn (:vis-1 spec))
+        res2 (seed* conn (:vis-2 spec))
+        dash-res (dashboard/create conn (dashboard-spec (:id (:vis-1 spec))
+                                                        (:id (:vis-2 spec))
+                                                        (:dataset res1))
+                                   {})]
+    {:seed-1 res1 :seed-2 res2 :dashboard dash-res}))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Test data

(hugsql/def-db-fns "akvo/lumen/lib/visualisation.sql")


(defn dashboard-spec [v1-id v2-id]
  (w/keywordize-keys
   {"type"     "dashboard"
    "title"    "My first Dashboard"

(ns akvo.lumen.endpoint.share-test
  {:functional true}
  (:require [akvo.lumen.endpoint.commons.variant :as variant]
            [akvo.lumen.fixtures :refer [*tenant-conn*
                                         tenant-conn-fixture
                                         system-fixture]]
            [akvo.lumen.lib.dashboard :as dashboard]
            [akvo.lumen.lib.dataset :as ds]
            [akvo.lumen.lib.share :as share]
            [akvo.lumen.test-utils :as tu]
            [akvo.lumen.util :refer [gen-table-name squuid]]
            [clojure.java.jdbc :as jdbc]
            [clojure.test :refer :all]
            [clojure.tools.logging :as log]
            [clojure.walk :as w]
            [hugsql.core :as hugsql]))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
