Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit d61ac30

Browse files
authored
Merge pull request #99 from mironal/test-timeline-v1
Test timeline v1
2 parents 3144e3e + f78c7cc commit d61ac30

File tree

3 files changed

+142
-0
lines changed

3 files changed

+142
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import TwitterAPIKit
2+
import XCTest
3+
4+
class GetStatusesHomeTimelineRequestV1Tests: XCTestCase {
5+
override func setUpWithError() throws {
6+
}
7+
8+
override func tearDownWithError() throws {
9+
}
10+
11+
func test() throws {
12+
let req = GetStatusesHomeTimelineRequestV1(
13+
count: 11,
14+
maxID: "_m_",
15+
sinceID: "_s_",
16+
trimUser: true,
17+
excludeReplies: true,
18+
includeEntities: true
19+
)
20+
21+
XCTAssertEqual(req.method, .get)
22+
XCTAssertEqual(req.baseURLType, .api)
23+
XCTAssertEqual(req.path, "/1.1/statuses/home_timeline.json")
24+
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded)
25+
AssertEqualAnyDict(
26+
req.parameters,
27+
[
28+
"count": 11,
29+
"max_id": "_m_",
30+
"since_id": "_s_",
31+
"trim_user": true,
32+
"exclude_replies": true,
33+
"include_entities": true,
34+
]
35+
)
36+
}
37+
38+
func testDefaultArg() throws {
39+
let req = GetStatusesHomeTimelineRequestV1()
40+
41+
AssertEqualAnyDict(
42+
req.parameters,
43+
[:]
44+
)
45+
}
46+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import TwitterAPIKit
2+
import XCTest
3+
4+
class GetStatusesMentionsTimelineRequestV1Tests: XCTestCase {
5+
override func setUpWithError() throws {
6+
}
7+
8+
override func tearDownWithError() throws {
9+
}
10+
11+
func test() throws {
12+
let req = GetStatusesMentionsTimelineRequestV1(
13+
count: 100,
14+
maxID: "_m_",
15+
sinceID: "_s_",
16+
trimUser: true,
17+
includeEntities: true
18+
)
19+
20+
XCTAssertEqual(req.method, .get)
21+
XCTAssertEqual(req.baseURLType, .api)
22+
XCTAssertEqual(req.path, "/1.1/statuses/mentions_timeline.json")
23+
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded)
24+
AssertEqualAnyDict(
25+
req.parameters,
26+
[
27+
"count": 100,
28+
"max_id": "_m_",
29+
"since_id": "_s_",
30+
"trim_user": true,
31+
"include_entities": true,
32+
]
33+
)
34+
}
35+
36+
func testDefaultArg() throws {
37+
let req = GetStatusesMentionsTimelineRequestV1()
38+
39+
AssertEqualAnyDict(
40+
req.parameters,
41+
[:]
42+
)
43+
}
44+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import TwitterAPIKit
2+
import XCTest
3+
4+
class GetStatusesUserTimelineRequestV1Tests: XCTestCase {
5+
override func setUpWithError() throws {
6+
}
7+
8+
override func tearDownWithError() throws {
9+
}
10+
11+
func test() throws {
12+
let req = GetStatusesUserTimelineRequestV1(
13+
user: .userID("uid"),
14+
count: 12,
15+
maxID: "_m_",
16+
sinceID: "_s_",
17+
trimUser: true,
18+
includeRTs: true,
19+
excludeReplies: true
20+
)
21+
22+
XCTAssertEqual(req.method, .get)
23+
XCTAssertEqual(req.baseURLType, .api)
24+
XCTAssertEqual(req.path, "/1.1/statuses/user_timeline.json")
25+
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded)
26+
AssertEqualAnyDict(
27+
req.parameters,
28+
[
29+
"user_id": "uid",
30+
"count": 12,
31+
"max_id": "_m_",
32+
"since_id": "_s_",
33+
"trim_user": true,
34+
"include_rts": true,
35+
"exclude_replies": true,
36+
]
37+
)
38+
}
39+
40+
func testDefaultArg() throws {
41+
let req = GetStatusesUserTimelineRequestV1(
42+
user: .screenName("s")
43+
)
44+
45+
AssertEqualAnyDict(
46+
req.parameters,
47+
[
48+
"screen_name": "s"
49+
]
50+
)
51+
}
52+
}

0 commit comments

Comments
 (0)