Skip to content

Commit 35acc2b

Browse files
jlledomclaude
andcommitted
Fix tests
Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ff3f13b commit 35acc2b

30 files changed

+970
-281
lines changed

.gitleaks.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[allowlist]
2+
description = "Global Allowlist"
3+
4+
# Ignore based on any subset of the file path
5+
paths = [
6+
'''test/unit/authentication/by_password_test.rb''',
7+
'''test/integration/admin/api/buyers_users_controller_test.rb'''
8+
]

features/old/accounts/personal_details.feature

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ Feature: Personal Details
8181
And the "User extra required" field should contain "whatever"
8282

8383
Scenario: Update own password when the user was signed up with password
84-
Given the user was signed up with password
84+
Given Strong passwords are enabled
85+
And the user was signed up with password
8586
When I navigate to the Account Settings
8687
And I go to the provider personal details page
8788
And I fill in "New password" with "hi"
8889
And I fill in "Current password" with "supersecret"
8990
And I press "Update Details"
90-
Then field "New password" has inline error "is too short (minimum is 6 characters)"
91+
Then field "New password" has inline error "Password must be at least 16 characters long, and contain only valid characters"

features/old/providers/settings.feature

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@ Feature: Settings management
77
Background:
88
Given a provider is logged in
99

10-
Scenario: Strong password setting
11-
And I go to the usage rules settings page
12-
When I check "Strong passwords"
13-
And I press "Update settings"
14-
Then they should see a toast alert with text "Settings updated"
15-
And the provider should have strong passwords enabled
16-
When I uncheck "Strong passwords"
17-
And I press "Update settings"
18-
Then they should see a toast alert with text "Settings updated"
19-
And the provider should have strong passwords disabled
20-
2110
Scenario: Account approval required checkbox is enabled
2211
Given the provider has 1 account plan
2312
When I go to the usage rules settings page

features/old/signup/strong_passwords.feature

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Feature: Signup with strong passwords
1313

1414

1515
Scenario: Strong password is required
16-
Given provider "foo.3scale.localhost" is requiring strong passwords
16+
Given Strong passwords are enabled
1717
When I go to the sign up page
1818
And I fill in the following:
1919
| Email | bender@planet.ex |
@@ -24,3 +24,28 @@ Feature: Signup with strong passwords
2424

2525
And I press "Sign up"
2626
Then I should see the error that the password is too weak
27+
28+
Scenario: Strong password is accepted
29+
Given Strong passwords are enabled
30+
When I go to the sign up page
31+
And I fill in the following:
32+
| Email | bender@planet.ex |
33+
| Username | bender |
34+
| Password | superSecret1234# |
35+
| Password confirmation | superSecret1234# |
36+
| Organization/Group Name | Planet eXpress |
37+
38+
And I press "Sign up"
39+
Then I should see "Thank you"
40+
41+
Scenario: Weak password is accepted when strong passwords are disabled
42+
When I go to the sign up page
43+
And I fill in the following:
44+
| Email | bender@planet.ex |
45+
| Username | bender |
46+
| Password | weakpwd |
47+
| Password confirmation | weakpwd |
48+
| Organization/Group Name | Planet eXpress |
49+
50+
And I press "Sign up"
51+
Then I should see "Thank you"

features/old/signup/with_invitation.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ Feature: Signup with invitation
2222
When I fill in "Username" with "bob"
2323
And I fill in "First name" with "bob"
2424
And I fill in "Last name" with "dole"
25-
And I fill in "Password" with "monkey"
26-
And I fill in "Password confirmation" with "monkey"
25+
And I fill in "Password" with "superSecret1234#"
26+
And I fill in "Password confirmation" with "superSecret1234#"
2727
And I press "Sign up"
2828
Then I should see "Thanks for signing up! You can now sign in"
2929
And the current domain should be the admin domain of provider "foo.3scale.localhost"
3030
But "bob@foo.3scale.localhost" should receive no email with subject "Account Activation"
3131
When I fill in "Username" with "bob"
32-
And I fill in "Password" with "monkey"
32+
And I fill in "Password" with "superSecret1234#"
3333
And I press "Sign in"
3434
Then I should be logged in as "bob"

features/provider/admin/account/invitations.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Feature: Provider Account Settings User Invitations
8282
And the form is submitted with:
8383
| Email | peter@example.com |
8484
| Username | peter |
85-
| Password | 123456 |
86-
| Password confirmation | 123456 |
85+
| Password | superSecret1234# |
86+
| Password confirmation | superSecret1234# |
8787
And they log out
8888
When the provider logs in
8989
And they go to the provider users page

features/provider/password/reset.feature

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,22 @@ Feature: Provider password reset
5151
Scenario: Set a new password
5252
Given the user has requested a new password
5353
And follow the link found in the provider password reset email send to "pepe@example.com"
54-
And they fill in "Password" with "monkey"
55-
And they fill in "Password confirmation" with "monkey"
54+
And they fill in "Password" with "superSecret1234#"
55+
And they fill in "Password confirmation" with "superSecret1234#"
5656
And press "Change Password"
5757
Then they should see "The password has been changed"
5858
And the current page is the provider login page
59-
And the user is now able to sign in with password "monkey"
59+
And the user is now able to sign in with password "superSecret1234#"
6060

6161
Scenario: New password form validation
6262
Given the user has requested a new password
6363
And follow the link found in the provider password reset email send to "pepe@example.com"
64-
And they fill in "Password" with "monkey"
64+
And they fill in "Password" with "superSecret1234#"
6565
And they fill in "Password confirmation" with ""
6666
Then the submit button is disabled
67-
When they fill in "Password confirmation" with "donkey"
67+
When they fill in "Password confirmation" with "superSecret1234#5"
6868
Then the submit button is disabled
69-
When they fill in "Password confirmation" with "monkey"
69+
When they fill in "Password confirmation" with "superSecret1234#"
7070
Then the submit button is enabled
7171

7272
Scenario: Invalid password reset token
@@ -83,8 +83,8 @@ Feature: Provider password reset
8383
Scenario: Reuse a password reset token
8484
Given the user has requested a new password
8585
And follow the link found in the provider password reset email send to "pepe@example.com"
86-
And they fill in "Password" with "monkey"
87-
And they fill in "Password confirmation" with "monkey"
86+
And they fill in "Password" with "superSecret1234#"
87+
And they fill in "Password confirmation" with "superSecret1234#"
8888
When press "Change Password"
8989
Then they should see "The password has been changed"
9090
When follow the link found in the provider password reset email send to "pepe@example.com"

features/step_definitions/settings_steps.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
account.settings.update!(attributes)
1212
end
1313

14-
Then "{provider} should have strong passwords {enabled}" do |provider, enabled|
15-
assert provider.settings.reload.strong_passwords_enabled == enabled
16-
end
17-
1814
Given "{provider} has {count} account plan(s)" do |provider, count|
1915
current_size = provider.account_plans.size
2016
if count > current_size

features/step_definitions/strong_passwords_steps.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# frozen_string_literal: true
22

3-
Given "{provider} is requiring strong passwords" do |provider|
4-
provider.settings.update_attribute :strong_passwords_enabled, true
3+
# When RAILS_ENV=test, strong passwords are disabled by default
4+
Given "Strong passwords are enabled" do
5+
Rails.configuration.three_scale.stubs(:strong_passwords_disabled).returns(false)
56
end
67

78
Then /^I should see the error that the password is too weak$/ do

0 commit comments

Comments
 (0)