Skip to content

Commit

Permalink
Merge pull request #115 from vish-mv/main
Browse files Browse the repository at this point in the history
Update public user and post id use for test as final values
  • Loading branch information
NipunaRanasinghe committed Jul 4, 2024
2 parents 45757c8 + 316577d commit bfff006
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions ballerina/tests/tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ configurable string serviceUrl = isLiveServer ? "https://api.twitter.com/2" : "h
ConnectionConfig config = {auth: {token}};
final Client twitter = check new Client(config, serviceUrl);

final string testUserId = "15594932";
final string testPostId = "1808153657558311048";

@test:Config {
groups: ["live_tests", "mock_tests"]
}
Expand Down Expand Up @@ -54,7 +57,7 @@ isolated function testgetUserIdByUseName() returns error? {
isolated function testUserLikeAPost() returns error? {
UsersLikesCreateResponse response = check twitter->/users/[userId]/likes.post(
payload = {
tweet_id: "1806286701704462623"
tweet_id: testPostId
}
);
test:assertTrue(response?.data !is ());
Expand All @@ -65,7 +68,7 @@ isolated function testUserLikeAPost() returns error? {
groups: ["live_tests", "mock_tests"]
}
isolated function testUserUnlikeAPost() returns error? {
UsersLikesDeleteResponse response = check twitter->/users/[userId]/likes/["1806286701704462623"].delete();
UsersLikesDeleteResponse response = check twitter->/users/[userId]/likes/[testPostId].delete();
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
}
Expand All @@ -74,7 +77,7 @@ isolated function testUserUnlikeAPost() returns error? {
groups: ["live_tests", "mock_tests"]
}
isolated function testPostLookup() returns error? {
Get2TweetsIdResponse response = check twitter->/tweets/["1806286701704462623"]();
Get2TweetsIdResponse response = check twitter->/tweets/[testPostId]();
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
}
Expand All @@ -84,7 +87,7 @@ isolated function testPostLookup() returns error? {
}
isolated function testBookmarkPost() returns error? {
BookmarkMutationResponse response = check twitter->/users/[userId]/bookmarks.post(
payload = {tweet_id: "1806286701704462623"}
payload = {tweet_id: testPostId}
);
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
Expand All @@ -94,7 +97,7 @@ isolated function testBookmarkPost() returns error? {
groups: ["live_tests", "mock_tests"]
}
isolated function testBookmarkDelete() returns error? {
BookmarkMutationResponse response = check twitter->/users/[userId]/bookmarks/["1806286701704462623"].delete();
BookmarkMutationResponse response = check twitter->/users/[userId]/bookmarks/[testPostId].delete();
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
}
Expand All @@ -104,7 +107,7 @@ isolated function testBookmarkDelete() returns error? {
}
isolated function testRetweet() returns error? {
UsersRetweetsCreateResponse response = check twitter->/users/[userId]/retweets.post(
payload = {tweet_id: "1806286701704462623"}
payload = {tweet_id: testPostId}
);
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
Expand All @@ -114,7 +117,7 @@ isolated function testRetweet() returns error? {
groups: ["live_tests", "mock_tests"]
}
isolated function testDeleteRetweet() returns error? {
UsersRetweetsDeleteResponse response = check twitter->/users/[userId]/retweets/["1806286701704462623"].delete();
UsersRetweetsDeleteResponse response = check twitter->/users/[userId]/retweets/[testPostId].delete();
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
}
Expand All @@ -125,7 +128,7 @@ isolated function testDeleteRetweet() returns error? {
isolated function testFollowSpecificUser() returns error? {
UsersFollowingCreateResponse response = check twitter->/users/[userId]/following.post(
payload = {
target_user_id: "1803011651249278976"
target_user_id: testUserId
}
);
test:assertTrue(response?.data !is ());
Expand All @@ -136,7 +139,7 @@ isolated function testFollowSpecificUser() returns error? {
groups: ["live_tests", "mock_tests"]
}
isolated function testUnfollowSpecificUser() returns error? {
UsersFollowingDeleteResponse response = check twitter->/users/[userId]/following/["1803011651249278976"].delete();
UsersFollowingDeleteResponse response = check twitter->/users/[userId]/following/[testUserId].delete();
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
}
Expand All @@ -147,7 +150,7 @@ isolated function testUnfollowSpecificUser() returns error? {
isolated function muteSpecificUser() returns error? {
MuteUserMutationResponse response = check twitter->/users/[userId]/muting.post(
payload = {
target_user_id: "1803011651249278976"
target_user_id: testUserId
}
);
test:assertTrue(response?.data !is ());
Expand All @@ -159,7 +162,7 @@ isolated function muteSpecificUser() returns error? {
}

isolated function unmuteSpecificUser() returns error? {
MuteUserMutationResponse response = check twitter->/users/[userId]/muting/["1803011651249278976"].delete();
MuteUserMutationResponse response = check twitter->/users/[userId]/muting/[testUserId].delete();
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
}
Expand All @@ -168,7 +171,7 @@ isolated function unmuteSpecificUser() returns error? {
groups: ["live_tests", "mock_tests"]
}
isolated function findSpecificUser() returns error? {
Get2UsersResponse response = check twitter->/users(ids = ["1803011651249278976"]);
Get2UsersResponse response = check twitter->/users(ids = [testUserId]);
test:assertTrue(response?.data !is ());
test:assertTrue(response?.errors is ());
}

0 comments on commit bfff006

Please sign in to comment.