Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
frosty committed Jan 27, 2022
1 parent 8bb971c commit 23c73ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct PublicizeConnectionURLMatcher {
case .declinePath:
return "/decline"
case .authorizationPrefix:
return "https://public-api.wordpress.com/connect/"
return "https://public-api.wordpress.com/connect"
default:
return nil
}
Expand Down Expand Up @@ -137,8 +137,8 @@ struct PublicizeConnectionURLMatcher {
return .deny
}

// If we've made it this far and verifyRange is found then we're *probably*
// verifying the oauth request. There are edge cases ( :cough: tumblr :cough: )
// If we've made it this far and the `action=verify` query param is present then we're
// *probably* verifying the oauth request. There are edge cases ( :cough: tumblr :cough: )
// where verification is declined and we get a false positive.
if url(matchURL, contains: .verifyActionItem) {
return .verify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import XCTest
@testable import WordPress

class PublicizeConnectionURLMatcherTests: XCTestCase {
override func setUp() {
}

override func tearDown() {
}

func testURLContainingAuthorizationItem() {
let url = URL(string: "https://public-api.wordpress.com/connect/?action=verify")!
XCTAssertTrue(PublicizeConnectionURLMatcher.url(url, contains: .authorizationPrefix))
Expand Down Expand Up @@ -48,7 +42,7 @@ class PublicizeConnectionURLMatcherTests: XCTestCase {
XCTAssertTrue(PublicizeConnectionURLMatcher.url(url, contains: .codeItem))
}

func testURLContainingErrorItemItem() {
func testURLContainingErrorItem() {
let url = URL(string: "https://public-api.wordpress.com/connect/?state=abcdef&error=1234567")!
XCTAssertTrue(PublicizeConnectionURLMatcher.url(url, contains: .errorItem))
}
Expand Down

0 comments on commit 23c73ff

Please sign in to comment.