Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
d5df5571
Commit
d5df5571
authored
9 years ago
by
Cam Saül
Browse files
Options
Downloads
Patches
Plain Diff
update tests
parent
ff87bf19
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/metabase/api/meta/table.clj
+2
-2
2 additions, 2 deletions
src/metabase/api/meta/table.clj
test/metabase/api/meta/db_test.clj
+4
-4
4 additions, 4 deletions
test/metabase/api/meta/db_test.clj
test/metabase/api/meta/table_test.clj
+52
-32
52 additions, 32 deletions
test/metabase/api/meta/table_test.clj
with
58 additions
and
38 deletions
src/metabase/api/meta/table.clj
+
2
−
2
View file @
d5df5571
...
...
@@ -49,8 +49,8 @@
"Get all `Fields` for `Table` with ID."
[
id
]
(
read-check
Table
id
)
(
->
>
(
sel
:many
Field
:table_id
id,
:active
true,
:field_type
[
not=
"sensitive"
]
,
(
order
:name
:ASC
))
(
hydrate
:human_readable_name
)))
(
->
(
sel
:many
Field
:table_id
id,
:active
true,
:field_type
[
not=
"sensitive"
]
,
(
order
:name
:ASC
))
(
hydrate
:human_readable_name
)))
(
defendpoint
GET
"/:id/query_metadata"
"Get metadata about a `Table` useful for running queries.
...
...
This diff is collapsed.
Click to expand it.
test/metabase/api/meta/db_test.clj
+
4
−
4
View file @
d5df5571
...
...
@@ -158,11 +158,11 @@
(
expect
(
let
[
db-id
(
db-id
)]
[(
match-$
(
sel
:one
Table
:id
(
id
:categories
))
{
:description
nil,
:entity_type
nil,
:name
"CATEGORIES"
,
:rows
75
,
:updated_at
$,
:entity_name
nil,
:active
true,
:id
$,
:db_id
db-id,
:created_at
$
})
{
:description
nil,
:entity_type
nil,
:name
"CATEGORIES"
,
:rows
75
,
:updated_at
$,
:entity_name
nil,
:active
true,
:id
$,
:db_id
db-id,
:created_at
$
,
:human_readable_name
"Categories"
})
(
match-$
(
sel
:one
Table
:id
(
id
:checkins
))
{
:description
nil,
:entity_type
nil,
:name
"CHECKINS"
,
:rows
1000
,
:updated_at
$,
:entity_name
nil,
:active
true,
:id
$,
:db_id
db-id,
:created_at
$
})
{
:description
nil,
:entity_type
nil,
:name
"CHECKINS"
,
:rows
1000
,
:updated_at
$,
:entity_name
nil,
:active
true,
:id
$,
:db_id
db-id,
:created_at
$
,
:human_readable_name
"Checkins"
})
(
match-$
(
sel
:one
Table
:id
(
id
:users
))
{
:description
nil,
:entity_type
nil,
:name
"USERS"
,
:rows
15
,
:updated_at
$,
:entity_name
nil,
:active
true,
:id
$,
:db_id
db-id,
:created_at
$
})
{
:description
nil,
:entity_type
nil,
:name
"USERS"
,
:rows
15
,
:updated_at
$,
:entity_name
nil,
:active
true,
:id
$,
:db_id
db-id,
:created_at
$
,
:human_readable_name
"Users"
})
(
match-$
(
sel
:one
Table
:id
(
id
:venues
))
{
:description
nil,
:entity_type
nil,
:name
"VENUES"
,
:rows
100
,
:updated_at
$,
:entity_name
nil,
:active
true,
:id
$,
:db_id
db-id,
:created_at
$
})])
{
:description
nil,
:entity_type
nil,
:name
"VENUES"
,
:rows
100
,
:updated_at
$,
:entity_name
nil,
:active
true,
:id
$,
:db_id
db-id,
:created_at
$
,
:human_readable_name
"Venues"
})])
((
user->client
:rasta
)
:get
200
(
format
"meta/db/%d/tables"
(
db-id
))))
This diff is collapsed.
Click to expand it.
test/metabase/api/meta/table_test.clj
+
52
−
32
View file @
d5df5571
...
...
@@ -25,14 +25,32 @@
;; ## GET /api/meta/table?org
;; These should come back in alphabetical order and include relevant metadata
(
expect
(
set
(
mapcat
(
fn
[
dataset-name
]
(
with-dataset-when-testing
dataset-name
(
let
[
db-id
(
:id
(
datasets/db
*dataset*
))]
[{
:name
(
datasets/format-name
*dataset*
"categories"
)
,
:db_id
db-id,
:active
true,
:rows
75
,
:id
(
datasets/table-name->id
*dataset*
:categories
)}
{
:name
(
datasets/format-name
*dataset*
"checkins"
)
,
:db_id
db-id,
:active
true,
:rows
1000
,
:id
(
datasets/table-name->id
*dataset*
:checkins
)}
{
:name
(
datasets/format-name
*dataset*
"users"
)
,
:db_id
db-id,
:active
true,
:rows
15
,
:id
(
datasets/table-name->id
*dataset*
:users
)}
{
:name
(
datasets/format-name
*dataset*
"venues"
)
,
:db_id
db-id,
:active
true,
:rows
100
,
:id
(
datasets/table-name->id
*dataset*
:venues
)}])))
@
datasets/test-dataset-names
))
(
expect
(
set
(
reduce
concat
(
for
[
dataset-name
@
datasets/test-dataset-names
]
(
with-dataset-when-testing
dataset-name
[{
:name
(
format-name
"categories"
)
:human_readable_name
"Categories"
:db_id
(
db-id
)
:active
true
:rows
75
:id
(
id
:categories
)}
{
:name
(
format-name
"checkins"
)
:human_readable_name
"Checkins"
:db_id
(
db-id
)
:active
true
:rows
1000
:id
(
id
:checkins
)}
{
:name
(
format-name
"users"
)
:human_readable_name
"Users"
:db_id
(
db-id
)
:active
true
:rows
15
:id
(
id
:users
)}
{
:name
(
format-name
"venues"
)
:human_readable_name
"Venues"
:db_id
(
db-id
)
:active
true
:rows
100
:id
(
id
:venues
)}]))))
(
->>
((
user->client
:rasta
)
:get
200
"meta/table"
)
(
map
#
(
dissoc
%
:db
:created_at
:updated_at
:entity_name
:description
:entity_type
))
set
))
...
...
@@ -64,31 +82,33 @@
;; ## GET /api/meta/table/:id/fields
(
expect
[(
match-$
(
sel
:one
Field
:id
(
id
:categories
:id
))
{
:description
nil
:table_id
(
id
:categories
)
:special_type
"id"
:name
"ID"
:updated_at
$
:active
true
:id
(
id
:categories
:id
)
:field_type
"info"
:position
0
:preview_display
true
:created_at
$
:base_type
"BigIntegerField"
})
{
:description
nil
:table_id
(
id
:categories
)
:special_type
"id"
:name
"ID"
:human_readable_name
"Id"
:updated_at
$
:active
true
:id
(
id
:categories
:id
)
:field_type
"info"
:position
0
:preview_display
true
:created_at
$
:base_type
"BigIntegerField"
})
(
match-$
(
sel
:one
Field
:id
(
id
:categories
:name
))
{
:description
nil
:table_id
(
id
:categories
)
:special_type
"name"
:name
"NAME"
:updated_at
$
:active
true
:id
(
id
:categories
:name
)
:field_type
"info"
:position
0
:preview_display
true
:created_at
$
:base_type
"TextField"
})]
{
:description
nil
:table_id
(
id
:categories
)
:special_type
"name"
:name
"NAME"
:human_readable_name
"Name"
:updated_at
$
:active
true
:id
(
id
:categories
:name
)
:field_type
"info"
:position
0
:preview_display
true
:created_at
$
:base_type
"TextField"
})]
((
user->client
:rasta
)
:get
200
(
format
"meta/table/%d/fields"
(
id
:categories
))))
;; ## GET /api/meta/table/:id/query_metadata
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment