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

URNs refactor #738

Merged
merged 2 commits into from
May 7, 2024
Merged

URNs refactor #738

merged 2 commits into from
May 7, 2024

Conversation

rowanseymour
Copy link
Member

No description provided.

@@ -195,7 +196,7 @@ func (ts *BackendTestSuite) TestDeleteMsgByExternalID() {
func (ts *BackendTestSuite) TestContact() {
knChannel := ts.getChannel("KN", "dbc126ed-66bc-4e28-b67b-81dc3327c95d")
clog := courier.NewChannelLog(courier.ChannelLogTypeUnknown, knChannel, nil)
urn, _ := urns.NewTelURNForCountry("12065551518", "US")
Copy link
Member Author

Choose a reason for hiding this comment

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

tests like this don't need to call URN parsing functions.. especially if they're not checking for errors

Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 87.73585% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 74.60%. Comparing base (2292ce7) to head (1b97543).

Files Patch % Lines
handlers/external/handler.go 55.55% 4 Missing ⚠️
handlers/utils.go 0.00% 3 Missing ⚠️
backends/rapidpro/channel.go 33.33% 2 Missing ⚠️
handlers/facebook_legacy/handler.go 94.11% 1 Missing ⚠️
handlers/meta/urns.go 85.71% 1 Missing ⚠️
handlers/viber/handler.go 87.50% 1 Missing ⚠️
handlers/zenvia/handlers.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #738      +/-   ##
==========================================
- Coverage   74.61%   74.60%   -0.02%     
==========================================
  Files         110      111       +1     
  Lines       13284    13293       +9     
==========================================
+ Hits         9912     9917       +5     
- Misses       2659     2663       +4     
  Partials      713      713              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -21,10 +21,10 @@ var testChannels = []courier.Channel{

const (
receiveURL = "/c/mbd/8eb23e93-5ecb-45ba-b726-3b064e0c56ab/receive"
validReceive = `{"receiver":"18005551515","sender":"188885551515","message":"Test again","date":1690386569,"date_utc":1690418969,"reference":"1","id":"b6aae1b5dfb2427a8f7ea6a717ba31a9","message_id":"3b53c137369242138120d6b0b2122607","recipient":"18005551515","originator":"188885551515","body":"Test 3","createdDatetime":"2023-07-27T00:49:29+00:00","mms":false}`
Copy link
Member Author

Choose a reason for hiding this comment

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

@tybritten I think you added this handler and I assume 188885551515 is a mistake (too long to be a US number) and there isn't something weird going on I'm not aware of...

@@ -168,7 +135,6 @@ var testCases = []IncomingTestCase{
{Label: "Receive Attachment", URL: "/c/twt/8eb23e93-5ecb-45ba-b726-3b064e0c568c/receive", Data: attachment, ExpectedRespStatus: 200, ExpectedBodyContains: "Accepted",
ExpectedMsgText: Sp("Hello"), ExpectedAttachments: []string{"https://image.foo.com/image.jpg"}, ExpectedURN: "twitterid:272953809#nicpottier", ExpectedExternalID: "958501034212564996", ExpectedDate: time.Date(2018, 1, 31, 0, 43, 49, 301000000, time.UTC)},
{Label: "Not JSON", URL: "/c/twt/8eb23e93-5ecb-45ba-b726-3b064e0c568c/receive", Data: notJSON, ExpectedRespStatus: 400, ExpectedBodyContains: "Error"},
{Label: "Invalid Twitter handle", URL: "/c/twt/8eb23e93-5ecb-45ba-b726-3b064e0c568c/receive", Data: invalidTwitterHandle, ExpectedRespStatus: 400, ExpectedBodyContains: "invalid twitter handle"},
Copy link
Member Author

Choose a reason for hiding this comment

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

this test case is testing if the twitter API gives us an invalid handle.. which then becomes the display part of the URN.. and we're no longer validating the display part of URNs... which I'm fine with because this can't happen

@rowanseymour rowanseymour requested a review from norkans7 May 7, 2024 21:02
@rowanseymour rowanseymour merged commit e4ed5ea into main May 7, 2024
7 checks passed
@rowanseymour rowanseymour deleted the urns_refactor branch May 7, 2024 21:33
@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants