Skip to content
Snippets Groups Projects
Commit 40e190f1 authored by Cam Saül's avatar Cam Saül
Browse files

Fix test failures from #4147 :unamused:

parent 59557ddd
No related branches found
No related tags found
No related merge requests found
......@@ -113,11 +113,9 @@
(when (and (email/email-configured?)
(public-settings/anon-tracking-enabled)
(not (follow-up-email-sent)))
(println "here") ; NOCOMMIT
;; grab the oldest admins email address (likely the user who created this MB instance), that's who we'll send to
;; TODO - Does it make to send to this user instead of `(public-settings/admin-email)`?
(when-let [admin (User :is_superuser true, :is_active true, {:order-by [:date_joined]})]
(println "admin:" admin) ; NOCOMMIT
(try
(messages/send-follow-up-email! (:email admin) "follow-up")
(catch Throwable e
......
(ns metabase.api.database-test
(:require [expectations :refer :all]
[toucan.db :as db]
(toucan [db :as db]
[hydrate :as hydrate])
[toucan.util.test :as tt]
[metabase.driver :as driver]
(metabase.models [database :refer [Database]]
......@@ -252,7 +253,7 @@
:schema "PUBLIC"
:name "CATEGORIES"
:display_name "Categories"
:fields [(match-$ (Field (id :categories :id))
:fields [(match-$ (hydrate/hydrate (Field (id :categories :id)) :values)
{:description nil
:table_id (id :categories)
:caveats nil
......@@ -273,8 +274,8 @@
:visibility_type "normal"
:fk_target_field_id $
:parent_id nil
:values []})
(match-$ (Field (id :categories :name))
:values $})
(match-$ (hydrate/hydrate (Field (id :categories :name)) :values)
{:description nil
:table_id (id :categories)
:caveats nil
......@@ -295,7 +296,7 @@
:visibility_type "normal"
:fk_target_field_id $
:parent_id nil
:values []})]
:values $})]
:segments []
:metrics []
:rows 75
......
(ns metabase.api.table-test
"Tests for /api/table endpoints."
(:require [expectations :refer :all]
[toucan.db :as db]
(toucan [db :as db]
[hydrate :as hydrate])
[toucan.util.test :as tt]
(metabase [driver :as driver]
[http-client :as http]
......@@ -127,7 +128,7 @@
;; ## GET /api/table/:id/query_metadata
(expect
(merge (table-defaults)
(match-$ (Table (id :categories))
(match-$ (hydrate/hydrate (Table (id :categories)) :field_values)
{:schema "PUBLIC"
:name "CATEGORIES"
:display_name "Categories"
......@@ -160,7 +161,8 @@
:updated_at $
:id (id :categories)
:raw_table_id $
:created_at $}))
:created_at $
:field_values (tu/obj->json->obj (:field_values $$))}))
((user->client :rasta) :get 200 (format "table/%d/query_metadata" (id :categories))))
......
......@@ -75,7 +75,7 @@
{:id (id :venues :id)}
{:id (id :venues :latitude)}
{:id (id :venues :longitude)}
{:id (id :venues :name), :values nil}
{:id (id :venues :name), :values (db/select-one-field :values 'FieldValues, :field_id (id :venues :name))}
{:id (id :venues :price), :values [1 2 3 4]}]}
(driver/analyze-table (H2Driver.) @venues-table (set (mapv :id (table/fields @venues-table)))))
......
......@@ -19,7 +19,7 @@
(defn- api-call-was-successful? {:style/indent 0} [response]
(when (and (string? response)
(not= response "You don't have permissions to do that."))
(println "created users:" (db/select-field :email 'User)) ; NOCOMMIT
(println "users in db:" (db/select-field :email 'User)) ; NOCOMMIT
(println "RESPONSE:" response)) ; DEBUG
(not= response "You don't have permissions to do that."))
......
......@@ -10,7 +10,7 @@
;; (#2332) check that if field values are long we skip over them
(expect
{:values nil}
(with-redefs-fn {#'metadata-queries/field-distinct-values (constantly [(str/join (repeat 5000 "A"))])}
(with-redefs-fn {#'metadata-queries/field-distinct-values (constantly [(str/join (repeat 50000 "A"))])}
#(test:cardinality-and-extract-field-values {} {})))
(expect
......
......@@ -3,6 +3,7 @@
;; TODO - maybe this namespace should just be `metabase.test.users`.
(:require [medley.core :as m]
[toucan.db :as db]
[metabase.core :as core]
[metabase.http-client :as http]
(metabase.models [permissions-group :as perms-group]
[user :refer [User]])
......@@ -51,6 +52,9 @@
:or {superuser false
active true}}]
{:pre [(string? email) (string? first) (string? last) (string? password) (m/boolean? superuser) (m/boolean? active)]}
(when-not (core/initialized?)
(println "Metabase is not yet initialized, waiting 5 seconds...")
(Thread/sleep 5000))
(or (User :email email)
(db/insert! User
:email email
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment