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
d414c0d9
Commit
d414c0d9
authored
10 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
this should fix allen's test
parent
21bf4f85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/metabase/api/user_test.clj
+21
-18
21 additions, 18 deletions
test/metabase/api/user_test.clj
with
21 additions
and
18 deletions
test/metabase/api/user_test.clj
+
21
−
18
View file @
d414c0d9
...
...
@@ -122,21 +122,24 @@
;; ## PUT /api/user/:id/password
;; Test that a User can change their password
(
expect-eval-actual-first
(
sel
:one
:fields
[
Session
:id
]
(
order
:created_at
:desc
))
; get the latest Session from the DB
(
let
[
password
{
:old
"password"
:new
"new_password"
}
{
:keys
[
email
id
]
:as
user
}
(
create-user
:password
(
:old
password
))
creds
{
:old
{
:password
(
:old
password
)
:email
email
}
:new
{
:password
(
:new
password
)
:email
email
}}]
;; Check that creds work
(
metabase.http-client/client
:post
200
"session"
(
:old
creds
))
;; Change the PW
(
metabase.http-client/client
(
:old
creds
)
:put
200
(
format
"user/%d/password"
id
)
{
:password
(
:new
password
)
:old_password
(
:old
password
)})
;; Old creds should no longer work
(
assert
(
=
(
metabase.http-client/client
:post
400
"session"
(
:old
creds
))
"password mismatch"
))
;; New creds *should* work
(
metabase.http-client/client
:post
200
"session"
(
:new
creds
))))
(
let
[
user-last-name
(
random-name
)]
(
expect-eval-actual-first
(
let
[{
user-id
:id
}
(
sel
:one
User
:last_name
user-last-name
)]
(
sel
:one
:fields
[
Session
:id
]
:user_id
user-id
(
order
:created_at
:desc
)))
; get the latest Session for this User
(
let
[
password
{
:old
"password"
:new
"new_password"
}
{
:keys
[
email
id
]
:as
user
}
(
create-user
:password
(
:old
password
)
:last_name
user-last-name
)
creds
{
:old
{
:password
(
:old
password
)
:email
email
}
:new
{
:password
(
:new
password
)
:email
email
}}]
;; Check that creds work
(
metabase.http-client/client
:post
200
"session"
(
:old
creds
))
;; Change the PW
(
metabase.http-client/client
(
:old
creds
)
:put
200
(
format
"user/%d/password"
id
)
{
:password
(
:new
password
)
:old_password
(
:old
password
)})
;; Old creds should no longer work
(
assert
(
=
(
metabase.http-client/client
:post
400
"session"
(
:old
creds
))
"password mismatch"
))
;; New creds *should* work
(
metabase.http-client/client
:post
200
"session"
(
:new
creds
)))))
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