Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change bio limit from 160 to 500 #10790

Merged
merged 4 commits into from
May 19, 2019
Merged

Change bio limit from 160 to 500 #10790

merged 4 commits into from
May 19, 2019

Conversation

trwnh
Copy link
Member

@trwnh trwnh commented May 19, 2019

Fix #10628

Just following #10628 (comment)

@trwnh trwnh changed the title WIP: Change bio limit from 160 to 500 Change bio limit from 160 to 500 May 19, 2019
@trwnh
Copy link
Member Author

trwnh commented May 19, 2019

Looks like CI is failing because some of the tests expect longer than 160 to fail, but now they succeed -- not entirely sure how to fix that in CI.

@Gargron
Copy link
Member

Gargron commented May 19, 2019

You need to adjust tests in:

  • spec/controllers/api/v1/accounts/credentials_controller_spec.rb:68
  • spec/models/account_spec.rb:607

@trwnh
Copy link
Member Author

trwnh commented May 19, 2019

looks like just the account_spec needed to be updated from 161 to 501. the api one just asserts that an unprocessable status returns an error instead of 200 ok. i'll wait for ci to recheck but hopefully that should do it

@Gargron
Copy link
Member

Gargron commented May 19, 2019

No, sorry, it still needs an adjustment in the other file.

@trwnh
Copy link
Member Author

trwnh commented May 19, 2019

I'm not sure how to fix the other file. Maybe it's a Ruby syntax thing I'm not understanding, but it looks logically correct to me.

CI gives this:

1) Api::V1::Accounts::CredentialsController with an oauth token PATCH #update with invalid data returns http unprocessable entity
     Failure/Error: expect(response).to have_http_status(:unprocessable_entity)
       expected the response to have status code :unprocessable_entity (422) but it was :ok (200)
     # ./spec/controllers/api/v1/accounts/credentials_controller_spec.rb:68:in `block (5 levels) in <top (required)>'

Context around ./spec/controllers/api/v1/accounts/credentials_controller_spec.rb:68:

      describe 'with invalid data' do
        before do
          patch :update, params: { note: 'This is too long. ' * 10 }
        end

        it 'returns http unprocessable entity' do
          expect(response).to have_http_status(:unprocessable_entity)
        end
      end

What should it be changed to? It seems to me like it's describing a test case that returns "unprocessable" and expecting it to have the "unprocessable" status code.

@Gargron
Copy link
Member

Gargron commented May 19, 2019

The test case was expecting an error, but it is getting success instead, because of the raised limit. 'This is too long. ' * 10 repeats the string 10 times. Which is below 500 characters.

@trwnh
Copy link
Member Author

trwnh commented May 19, 2019

Ahh, OK. I had no idea what exactly the *10 was doing, especially since the other test used a much less ambiguous Fabricate.build(:account, note: Faker::Lorem.characters(501)). Changed 10 to 30 so that the resulting string is 540 characters long.

@trwnh
Copy link
Member Author

trwnh commented May 19, 2019

OK, looks like it passes all tests now!

@Gargron Gargron merged commit a6caf91 into mastodon:master May 19, 2019
kedamaDQ pushed a commit to kedamaDQ/mastodon that referenced this pull request May 24, 2019
* Change note_length validator from 160 to 500

* Change input maxlength from 160 to 500

* update bio test from 160 to 500

* Multiply a string 30 times instead of 10
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
* Change note_length validator from 160 to 500

* Change input maxlength from 160 to 500

* update bio test from 160 to 500

* Multiply a string 30 times instead of 10
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
* Change note_length validator from 160 to 500

* Change input maxlength from 160 to 500

* update bio test from 160 to 500

* Multiply a string 30 times instead of 10
messenjahofchrist pushed a commit to Origin-Creative/mastodon that referenced this pull request Jul 30, 2021
* Change note_length validator from 160 to 500

* Change input maxlength from 160 to 500

* update bio test from 160 to 500

* Multiply a string 30 times instead of 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bio limits too restrictive
2 participants