This repository has been archived by the owner on Jun 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from mironal/test-timeline-v1
Test timeline v1
- Loading branch information
Showing
3 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
Tests/TwitterAPIKitTests/APIv1/Timelines/GetStatusesHomeTimelineRequestV1Tests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class GetStatusesHomeTimelineRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = GetStatusesHomeTimelineRequestV1( | ||
count: 11, | ||
maxID: "_m_", | ||
sinceID: "_s_", | ||
trimUser: true, | ||
excludeReplies: true, | ||
includeEntities: true | ||
) | ||
|
||
XCTAssertEqual(req.method, .get) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/statuses/home_timeline.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"count": 11, | ||
"max_id": "_m_", | ||
"since_id": "_s_", | ||
"trim_user": true, | ||
"exclude_replies": true, | ||
"include_entities": true, | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = GetStatusesHomeTimelineRequestV1() | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[:] | ||
) | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
Tests/TwitterAPIKitTests/APIv1/Timelines/GetStatusesMentionsTimelineRequestV1Tests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class GetStatusesMentionsTimelineRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = GetStatusesMentionsTimelineRequestV1( | ||
count: 100, | ||
maxID: "_m_", | ||
sinceID: "_s_", | ||
trimUser: true, | ||
includeEntities: true | ||
) | ||
|
||
XCTAssertEqual(req.method, .get) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/statuses/mentions_timeline.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"count": 100, | ||
"max_id": "_m_", | ||
"since_id": "_s_", | ||
"trim_user": true, | ||
"include_entities": true, | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = GetStatusesMentionsTimelineRequestV1() | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[:] | ||
) | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
Tests/TwitterAPIKitTests/APIv1/Timelines/GetStatusesUserTimelineRequestV1Tests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class GetStatusesUserTimelineRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = GetStatusesUserTimelineRequestV1( | ||
user: .userID("uid"), | ||
count: 12, | ||
maxID: "_m_", | ||
sinceID: "_s_", | ||
trimUser: true, | ||
includeRTs: true, | ||
excludeReplies: true | ||
) | ||
|
||
XCTAssertEqual(req.method, .get) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/statuses/user_timeline.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"user_id": "uid", | ||
"count": 12, | ||
"max_id": "_m_", | ||
"since_id": "_s_", | ||
"trim_user": true, | ||
"include_rts": true, | ||
"exclude_replies": true, | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = GetStatusesUserTimelineRequestV1( | ||
user: .screenName("s") | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"screen_name": "s" | ||
] | ||
) | ||
} | ||
} |