-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: updates deprecated method signatures and fixes linter complexi…
…ty issues
- Loading branch information
Showing
2 changed files
with
67 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,25 +12,26 @@ class TestUserAPI < Test::Unit::TestCase | |
PassageClient = Passage::Client.new(app_id: ENV['APP_ID'], api_key: ENV['API_KEY']) | ||
|
||
def setup | ||
@test_user = | ||
PassageClient.user.create( | ||
email: '[email protected]', | ||
user_metadata: { | ||
example1: 'cool' | ||
} | ||
) | ||
args = { | ||
'email' => '[email protected]', | ||
'user_metadata' => { | ||
'example1' => 'cool' | ||
} | ||
} | ||
@test_user = PassageClient.user.create(args: args) | ||
end | ||
|
||
def test_create_delete_user | ||
user = | ||
PassageClient.user.create( | ||
email: '[email protected]', | ||
user_metadata: { | ||
example1: 'cool' | ||
} | ||
) | ||
args = { | ||
'email' => 'passage+test-create[email protected]', | ||
'user_metadata' => { | ||
'example1' => 'cool' | ||
} | ||
} | ||
user = PassageClient.user.create(args: args) | ||
assert_equal '[email protected]', user.email | ||
assert_equal 'cool', user.user_metadata[:example1] | ||
|
||
deleted = PassageClient.user.delete(user_id: user.id) | ||
assert_equal true, deleted | ||
end | ||
|
@@ -62,9 +63,10 @@ def test_get_user_by_identifier_upper_case | |
|
||
def test_get_user_by_identifier_phone | ||
phone = '+15005550007' | ||
create_user = PassageClient.user.create( | ||
phone: phone | ||
) | ||
args = { | ||
'phone' => phone | ||
} | ||
create_user = PassageClient.user.create(args: args) | ||
user = PassageClient.user.get(user_id: create_user.id) | ||
assert_equal create_user.id, user.id | ||
|
||
|
@@ -74,7 +76,7 @@ def test_get_user_by_identifier_phone | |
assert_equal user, user_by_identifier | ||
end | ||
|
||
def test_invalid_get_user_by_identifier | ||
def test_invalid_get_by_identifier | ||
user = PassageClient.user.get(user_id: @test_user.id) | ||
assert_equal @test_user.id, user.id | ||
|
||
|
@@ -97,14 +99,13 @@ def test_activate_user | |
|
||
def test_update_user | ||
new_email = '[email protected]' | ||
user = | ||
PassageClient.user.update( | ||
user_id: @test_user.id, | ||
email: new_email, | ||
user_metadata: { | ||
example1: 'lame' | ||
} | ||
) | ||
opts = { | ||
'email' => new_email, | ||
'user_metadata' => { | ||
'example1' => 'lame' | ||
} | ||
} | ||
user = PassageClient.user.update(user_id: @test_user.id, options: opts) | ||
assert_equal @test_user.id, user.id | ||
assert_equal new_email, user.email | ||
assert_equal 'lame', user.user_metadata[:example1] | ||
|