-
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.
- Loading branch information
1 parent
0df970a
commit 5a15e55
Showing
6 changed files
with
39 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,7 @@ Metrics/ClassLength: | |
|
||
Layout/LineLength: | ||
Max: 120 | ||
|
||
Metrics/MethodLength: | ||
Max: 50 | ||
|
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
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 |
---|---|---|
|
@@ -6,8 +6,10 @@ Gem::Specification.new do |s| | |
s.name = 'passageidentity' | ||
s.version = Passage::VERSION | ||
s.summary = 'Passage Passkey Complete SDK' | ||
# rubocop:disable Layout/LineLength | ||
s.description = | ||
'Passkey Complete for Ruby - Integrate into your Ruby API or service to enable a completely passwordless standalone auth solution with Passage by 1Password.' | ||
# rubocop:enable Layout/LineLength | ||
s.authors = ['Passage by 1Password'] | ||
s.email = '[email protected]' | ||
s.files = ['lib/passageidentity.rb'] | ||
|
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ class TestUserAPI < Test::Unit::TestCase | |
Passage::Client.new(app_id: ENV['APP_ID'], api_key: ENV['API_KEY']) | ||
|
||
def setup | ||
$global_test_user = | ||
@test_user = | ||
PassageClient.user.create( | ||
email: '[email protected]', | ||
user_metadata: { | ||
|
@@ -37,91 +37,91 @@ def test_create_delete_user | |
end | ||
|
||
def test_get_user | ||
user = PassageClient.user.get(user_id: $global_test_user.id) | ||
assert_equal $global_test_user.id, user.id | ||
user = PassageClient.user.get(user_id: @test_user.id) | ||
assert_equal @test_user.id, user.id | ||
end | ||
|
||
def test_get_user_by_identifier | ||
user = PassageClient.user.get(user_id: $global_test_user.id) | ||
assert_equal $global_test_user.id, user.id | ||
user = PassageClient.user.get(user_id: @test_user.id) | ||
assert_equal @test_user.id, user.id | ||
|
||
user_by_identifier = PassageClient.user.get_by_identifier(user_identifier: $global_test_user.email) | ||
assert_equal $global_test_user.id, user_by_identifier.id | ||
user_by_identifier = PassageClient.user.get_by_identifier(user_identifier: @test_user.email) | ||
assert_equal @test_user.id, user_by_identifier.id | ||
|
||
assert_equal user, user_by_identifier | ||
end | ||
|
||
def test_get_user_by_identifier_upper_case | ||
user = PassageClient.user.get(user_id: $global_test_user.id) | ||
assert_equal $global_test_user.id, user.id | ||
user = PassageClient.user.get(user_id: @test_user.id) | ||
assert_equal @test_user.id, user.id | ||
|
||
user_by_identifier = PassageClient.user.get_by_identifier(user_identifier: $global_test_user.email.upcase) | ||
assert_equal $global_test_user.id, user_by_identifier.id | ||
user_by_identifier = PassageClient.user.get_by_identifier(user_identifier: @test_user.email.upcase) | ||
assert_equal @test_user.id, user_by_identifier.id | ||
|
||
assert_equal user, user_by_identifier | ||
end | ||
|
||
def test_get_user_by_identifier_phone | ||
$phone = '+15005550007' | ||
phone = '+15005550007' | ||
create_user = PassageClient.user.create( | ||
phone: $phone | ||
phone: phone | ||
) | ||
user = PassageClient.user.get(user_id: create_user.id) | ||
assert_equal create_user.id, user.id | ||
|
||
user_by_identifier = PassageClient.user.get_by_identifier(user_identifier: $phone) | ||
user_by_identifier = PassageClient.user.get_by_identifier(user_identifier: phone) | ||
assert_equal create_user.id, user_by_identifier.id | ||
|
||
assert_equal user, user_by_identifier | ||
end | ||
|
||
def test_invalid_get_user_by_identifier | ||
user = PassageClient.user.get(user_id: $global_test_user.id) | ||
assert_equal $global_test_user.id, user.id | ||
user = PassageClient.user.get(user_id: @test_user.id) | ||
assert_equal @test_user.id, user.id | ||
|
||
assert_raise Passage::PassageError do | ||
PassageClient.user.get_by_identifier(user_identifier: '[email protected]') | ||
end | ||
end | ||
|
||
def test_deactivate_user | ||
user = PassageClient.user.deactivate(user_id: $global_test_user.id) | ||
assert_equal $global_test_user.id, user.id | ||
user = PassageClient.user.deactivate(user_id: @test_user.id) | ||
assert_equal @test_user.id, user.id | ||
assert_equal 'inactive', user.status | ||
end | ||
|
||
def test_activate_user | ||
user = PassageClient.user.activate(user_id: $global_test_user.id) | ||
assert_equal $global_test_user.id, user.id | ||
user = PassageClient.user.activate(user_id: @test_user.id) | ||
assert_equal @test_user.id, user.id | ||
assert_equal 'active', user.status | ||
end | ||
|
||
def test_update_user | ||
new_email = '[email protected]' | ||
user = | ||
PassageClient.user.update( | ||
user_id: $global_test_user.id, | ||
user_id: @test_user.id, | ||
email: new_email, | ||
user_metadata: { | ||
example1: 'lame' | ||
} | ||
) | ||
assert_equal $global_test_user.id, user.id | ||
assert_equal @test_user.id, user.id | ||
assert_equal new_email, user.email | ||
assert_equal 'lame', user.user_metadata[:example1] | ||
end | ||
|
||
def test_list_devices | ||
devices = PassageClient.user.list_devices(user_id: $global_test_user.id) | ||
devices = PassageClient.user.list_devices(user_id: @test_user.id) | ||
assert_equal [], devices | ||
end | ||
|
||
def test_signout | ||
success = PassageClient.user.signout(user_id: $global_test_user.id) | ||
success = PassageClient.user.signout(user_id: @test_user.id) | ||
assert_equal true, success | ||
end | ||
|
||
def teardown | ||
PassageClient.user.delete(user_id: $global_test_user.id) | ||
PassageClient.user.delete(user_id: @test_user.id) | ||
end | ||
end |