Skip to content

Conversation

@Yang-33
Copy link
Contributor

@Yang-33 Yang-33 commented Apr 3, 2025

though there are similar tests, there are no tests yet that verify the value after serialization (to_json), so this change adds it.

@Yang-33 Yang-33 self-assigned this Apr 3, 2025
headers: {
'Authorization' => "Bearer test-channel-access-token"
},
body: expected_body
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

     
     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: POST https://api.line.me/v2/bot/message/broadcast with body '{"messages":[{"type":"flex","alt_text":"Test Alt Text","contents":{"type":"bubble","direction":"ltr","body":{"type":"text","text":"Test Text","size":"xl","weight":"bold"}}}],"notificationDisabled":false}' with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer test-channel-access-token', 'Content-Type'=>'application/json', 'Host'=>'api.line.me', 'User-Agent'=>'LINE-BotSDK-Ruby/2.0.0'}
     
       You can stub this request with the following snippet:
     
       stub_request(:post, "https://api.line.me/v2/bot/message/broadcast").
         with(
           body: "{\"messages\":[{\"type\":\"flex\",\"alt_text\":\"Test Alt Text\",\"contents\":{\"type\":\"bubble\",\"direction\":\"ltr\",\"body\":{\"type\":\"text\",\"text\":\"Test Text\",\"size\":\"xl\",\"weight\":\"bold\"}}}],\"notificationDisabled\":false}",
           headers: {
          'Accept'=>'*/*',
          'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
          'Authorization'=>'Bearer test-channel-access-token',
          'Content-Type'=>'application/json',
          'Host'=>'api.line.me',
          'User-Agent'=>'LINE-BotSDK-Ruby/2.0.0'
           }).
         to_return(status: 200, body: "", headers: {})
     
       registered request stubs:
     
       stub_request(:post, "https://api.line.me/v2/bot/message/broadcast").
         with(
           body: "{\"messages\":[{\"type\":\"flex\",\"altText\":\"Test Alt Text\",\"contents\":{\"type\":\"bubble\",\"direction\":\"ltr\",\"body\":{\"type\":\"text\",\"text\":\"Test Text\",\"size\":\"xl\",\"weight\":\"bold\"}}}],\"notificationDisabled\":false}",
           headers: {
          'Authorization'=>'Bearer test-channel-access-token'
           })
     
       Body diff:
        [["-", "messages[0].alt_text", "Test Alt Text"],
        ["+", "messages[0].altText", "Test Alt Text"]]

alt_text in Line::Bot::V2::MessagingApi::FlexMessage sends as alt_text(wrong), not altText(correct)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's related to #448 ..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#455 fixed this, thank you!

@Yang-33 Yang-33 requested a review from a team April 3, 2025 05:39
@Yang-33 Yang-33 merged commit 92c4dc9 into line:master Apr 3, 2025
6 checks passed
@Yang-33 Yang-33 deleted the flex-test branch April 3, 2025 07:58
@Yang-33
Copy link
Contributor Author

Yang-33 commented Apr 8, 2025

#365

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.

2 participants