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 25
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 #111 from mironal/test-collection-v1
Test collection v1
- Loading branch information
Showing
10 changed files
with
400 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
Tests/TwitterAPIKitTests/APIv1/Collection/GetCollectionsEntriesRequestV1Tests.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 GetCollectionsEntriesRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = GetCollectionsEntriesRequestV1( | ||
id: "_i_", | ||
count: 12, | ||
maxPosition: "_m_", | ||
minPosition: "_m_" | ||
) | ||
|
||
XCTAssertEqual(req.method, .get) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/entries.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"count": 12, | ||
"max_position": "_m_", | ||
"min_position": "_m_", | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = GetCollectionsEntriesRequestV1( | ||
id: "i" | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "i" | ||
] | ||
) | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
Tests/TwitterAPIKitTests/APIv1/Collection/GetCollectionsListRequestV1Tests.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 GetCollectionsListRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = GetCollectionsListRequestV1( | ||
user: .userID("uid"), | ||
count: 14, | ||
cursor: "_c_", | ||
tweetID: "_t_" | ||
) | ||
|
||
XCTAssertEqual(req.method, .get) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/list.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"user_id": "uid", | ||
"count": 14, | ||
"cursor": "_c_", | ||
"tweet_id": "_t_", | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = GetCollectionsListRequestV1( | ||
user: .screenName("s") | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"screen_name": "s" | ||
] | ||
) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Tests/TwitterAPIKitTests/APIv1/Collection/GetCollectionsShowRequestV1Tests.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,27 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class GetCollectionsShowRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = GetCollectionsShowRequestV1( | ||
id: "_i_" | ||
) | ||
|
||
XCTAssertEqual(req.method, .get) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/show.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_" | ||
] | ||
) | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
Tests/TwitterAPIKitTests/APIv1/Collection/PostCollectionsCreateRequestV1Tests.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 PostCollectionsCreateRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = PostCollectionsCreateRequestV1( | ||
name: "_n_", | ||
url: "_u_", | ||
description: "_d_", | ||
timelineOrder: .curationReverseChron | ||
) | ||
|
||
XCTAssertEqual(req.method, .post) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/create.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"name": "_n_", | ||
"url": "_u_", | ||
"description": "_d_", | ||
"timeline_order": "curation_reverse_chron", | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = PostCollectionsCreateRequestV1( | ||
name: "n" | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"name": "n" | ||
] | ||
) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Tests/TwitterAPIKitTests/APIv1/Collection/PostCollectionsDestroyRequestV1Tests.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,27 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class PostCollectionsDestroyRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = PostCollectionsDestroyRequestV1( | ||
id: "_i_" | ||
) | ||
|
||
XCTAssertEqual(req.method, .post) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/destroy.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_" | ||
] | ||
) | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
Tests/TwitterAPIKitTests/APIv1/Collection/PostCollectionsEntriesAddRequestV1Tests.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 PostCollectionsEntriesAddRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = PostCollectionsEntriesAddRequestV1( | ||
id: "_i_", | ||
tweetID: "_t_", | ||
above: true, | ||
relativeTo: "_r_" | ||
) | ||
|
||
XCTAssertEqual(req.method, .post) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/entries/add.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"tweet_id": "_t_", | ||
"above": true, | ||
"relative_to": "_r_", | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = PostCollectionsEntriesAddRequestV1( | ||
id: "_i_", | ||
tweetID: "_t_" | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"tweet_id": "_t_", | ||
] | ||
) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Tests/TwitterAPIKitTests/APIv1/Collection/PostCollectionsEntriesCurateRequestV1Tests.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,35 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class PostCollectionsEntriesCurateRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = PostCollectionsEntriesCurateRequestV1( | ||
id: "_i_", | ||
changes: [ | ||
.add(tweetID: "add_id"), | ||
.remove(tweetID: "remove_id"), | ||
] | ||
) | ||
|
||
XCTAssertEqual(req.method, .post) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/entries/curate.json") | ||
XCTAssertEqual(req.bodyContentType, .json) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"changes": [ | ||
["op": "add", "tweet_id": "add_id"], | ||
["op": "remove", "tweet_id": "remove_id"], | ||
], | ||
] | ||
) | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
Tests/TwitterAPIKitTests/APIv1/Collection/PostCollectionsEntriesMoveRequestV1Tests.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,50 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class PostCollectionsEntriesMoveRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = PostCollectionsEntriesMoveRequestV1( | ||
id: "_i_", | ||
tweetID: "_t_", | ||
above: true, | ||
relativeTo: "_r_" | ||
) | ||
|
||
XCTAssertEqual(req.method, .post) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/entries/move.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"tweet_id": "_t_", | ||
"above": true, | ||
"relative_to": "_r_", | ||
] | ||
) | ||
} | ||
|
||
func testDefaultArg() throws { | ||
let req = PostCollectionsEntriesMoveRequestV1( | ||
id: "_i_", | ||
tweetID: "_t_", | ||
relativeTo: "_r_" | ||
) | ||
|
||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"tweet_id": "_t_", | ||
"relative_to": "_r_", | ||
] | ||
) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Tests/TwitterAPIKitTests/APIv1/Collection/PostCollectionsEntriesRemoveRequestV1Tests.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,29 @@ | ||
import TwitterAPIKit | ||
import XCTest | ||
|
||
class PostCollectionsEntriesRemoveRequestV1Tests: XCTestCase { | ||
override func setUpWithError() throws { | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
} | ||
|
||
func test() throws { | ||
let req = PostCollectionsEntriesRemoveRequestV1( | ||
id: "_i_", | ||
tweetID: "_t_" | ||
) | ||
|
||
XCTAssertEqual(req.method, .post) | ||
XCTAssertEqual(req.baseURLType, .api) | ||
XCTAssertEqual(req.path, "/1.1/collections/entries/remove.json") | ||
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded) | ||
AssertEqualAnyDict( | ||
req.parameters, | ||
[ | ||
"id": "_i_", | ||
"tweet_id": "_t_", | ||
] | ||
) | ||
} | ||
} |
Oops, something went wrong.