-
-
Notifications
You must be signed in to change notification settings - Fork 927
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solves #4791
- Loading branch information
Showing
13 changed files
with
50 additions
and
235 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module AvoHelpers | ||
def avo_sign_in_as(user) | ||
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new( | ||
provider: "github", | ||
uid: "1", | ||
credentials: { | ||
token: user.oauth_token, | ||
expires: false | ||
}, | ||
info: { | ||
name: user.login | ||
} | ||
) | ||
|
||
@ip_address = create(:ip_address, ip_address: "127.0.0.1") | ||
|
||
stub_github_info_request(user.info_data) | ||
|
||
visit avo.root_path | ||
click_button "Log in with GitHub" | ||
|
||
page.assert_text user.login | ||
end | ||
end |
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
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 |
---|---|---|
|
@@ -5,32 +5,9 @@ class Avo::RubygemsSystemTest < ApplicationSystemTestCase | |
|
||
include ActiveJob::TestHelper | ||
|
||
def sign_in_as(user) | ||
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new( | ||
provider: "github", | ||
uid: "1", | ||
credentials: { | ||
token: user.oauth_token, | ||
expires: false | ||
}, | ||
info: { | ||
name: user.login | ||
} | ||
) | ||
|
||
create(:ip_address, ip_address: "127.0.0.1") | ||
|
||
stub_github_info_request(user.info_data) | ||
|
||
visit avo.root_path | ||
click_button "Log in with GitHub" | ||
|
||
page.assert_text user.login | ||
end | ||
|
||
test "release reserved namespace" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
rubygem = create(:rubygem, created_at: 40.days.ago) | ||
rubygem_attributes = rubygem.attributes.with_indifferent_access | ||
|
@@ -88,7 +65,7 @@ def sign_in_as(user) | |
test "Yank a rubygem" do | ||
Minitest::Test.make_my_diffs_pretty! | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
security_user = create(:user, email: "[email protected]") | ||
rubygem = create(:rubygem) | ||
|
@@ -163,7 +140,7 @@ def sign_in_as(user) | |
|
||
test "Yank all version of rubygem" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
security_user = create(:user, email: "[email protected]") | ||
rubygem = create(:rubygem) | ||
|
@@ -252,7 +229,7 @@ def sign_in_as(user) | |
|
||
test "add owner" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
security_user = create(:user, email: "[email protected]") | ||
rubygem = create(:rubygem) | ||
|
@@ -332,7 +309,7 @@ def sign_in_as(user) | |
|
||
test "upload versions file" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
visit avo.resources_rubygems_path | ||
|
||
|
@@ -353,7 +330,7 @@ def sign_in_as(user) | |
|
||
test "upload names file" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
visit avo.resources_rubygems_path | ||
|
||
|
@@ -374,7 +351,7 @@ def sign_in_as(user) | |
|
||
test "upload info file" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
version = create(:version) | ||
visit avo.resources_rubygem_path(version.rubygem) | ||
|
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 |
---|---|---|
|
@@ -5,31 +5,10 @@ class Avo::UsersSystemTest < ApplicationSystemTestCase | |
|
||
include ActiveJob::TestHelper | ||
|
||
def sign_in_as(user) | ||
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new( | ||
provider: "github", | ||
uid: "1", | ||
credentials: { | ||
token: user.oauth_token, | ||
expires: false | ||
}, | ||
info: { | ||
name: user.login | ||
} | ||
) | ||
@ip_address = create(:ip_address, ip_address: "127.0.0.1") | ||
stub_github_info_request(user.info_data) | ||
|
||
visit avo.root_path | ||
click_button "Log in with GitHub" | ||
|
||
page.assert_text user.login | ||
end | ||
|
||
test "reset mfa" do | ||
Minitest::Test.make_my_diffs_pretty! | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
user = create(:user) | ||
user.enable_totp!(ROTP::Base32.random_base32, :ui_and_api) | ||
|
@@ -102,7 +81,7 @@ def sign_in_as(user) | |
test "block user" do | ||
Minitest::Test.make_my_diffs_pretty! | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
user = create(:user) | ||
user.enable_totp!(ROTP::Base32.random_base32, :ui_and_api) | ||
|
@@ -200,7 +179,7 @@ def sign_in_as(user) | |
test "reset api key" do | ||
perform_enqueued_jobs do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
user = create(:user) | ||
user_attributes = user.attributes.with_indifferent_access | ||
|
@@ -267,7 +246,7 @@ def sign_in_as(user) | |
|
||
test "Yank rubygems" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
security_user = create(:user, email: "[email protected]") | ||
|
||
ownership = create(:ownership) | ||
|
@@ -366,7 +345,7 @@ def sign_in_as(user) | |
|
||
test "yank user" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
security_user = create(:user, email: "[email protected]") | ||
|
||
user = create(:user) | ||
|
@@ -510,7 +489,7 @@ def sign_in_as(user) | |
test "change user email" do | ||
perform_enqueued_jobs do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
user = create(:user) | ||
user_attributes = user.attributes.with_indifferent_access | ||
|
@@ -588,7 +567,7 @@ def sign_in_as(user) | |
|
||
test "create user" do | ||
admin_user = create(:admin_github_user, :is_admin) | ||
sign_in_as admin_user | ||
avo_sign_in_as admin_user | ||
|
||
visit avo.resources_users_path | ||
|
||
|
Oops, something went wrong.