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 #90 from mironal/test-fav-v1
Test fav v1
- Loading branch information
Showing
4 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
Tests/TwitterAPIKitTests/APIv1/Favorite/GetFavoritesRequestV1Tests.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,48 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class GetFavoritesRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = GetFavoritesRequestV1( | ||
target: .userID("uid"), | ||
count: 100, | ||
sinceID: "_s_", | ||
maxID: "_m_", | ||
includeEntities: true | ||
) | ||
|
||
XCTAssertEqual(req.method, .get) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/favorites/list.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"user_id": "uid", | ||
"count": 100, | ||
"since_id": "_s_", | ||
"max_id": "_m_", | ||
"include_entities": true, | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = GetFavoritesRequestV1( | ||
target: .screenName("s") | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"screen_name": "s" | ||
] | ||
) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Tests/TwitterAPIKitTests/APIv1/Favorite/PostFavoriteRequestV1Tests.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,42 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class PostFavoriteRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = PostFavoriteRequestV1( | ||
id: "_i_", | ||
includeEntities: true | ||
) | ||
|
||
XCTAssertEqual(req.method, .post) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/favorites/create.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"include_entities": true, | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = PostFavoriteRequestV1( | ||
id: "_i_" | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_" | ||
] | ||
) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Tests/TwitterAPIKitTests/APIv1/Favorite/PostUnFavoriteRequestV1Tests.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,42 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class PostUnFavoriteRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = PostUnFavoriteRequestV1( | ||
id: "_i_", | ||
includeEntities: true | ||
) | ||
|
||
XCTAssertEqual(req.method, .post) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/favorites/destroy.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"include_entities": true, | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = PostUnFavoriteRequestV1( | ||
id: "_i_" | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_" | ||
] | ||
) | ||
} | ||
} |
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