Real test and update to tests
This commit is contained in:
parent
41102d5348
commit
e47a9aa568
3 changed files with 32 additions and 3 deletions
|
|
@ -30,6 +30,7 @@ def follow(
|
|||
"sk": itemPKSK
|
||||
},
|
||||
"followType": entity,
|
||||
"parentSlug": parent_slug,
|
||||
"preferences": {
|
||||
"notification": True,
|
||||
"emailNew": False,
|
||||
|
|
|
|||
12
testing.py
12
testing.py
|
|
@ -43,8 +43,8 @@ def save_response(response):
|
|||
|
||||
|
||||
# print("-----------Get a user profile----------------")
|
||||
profile = API.run_job('userprofile.get', "simon-little")
|
||||
print(profile)
|
||||
# profile = API.run_job('userprofile.get', "simon-little")
|
||||
# print(profile)
|
||||
# print("-------------- Get a branch -----------------")
|
||||
# branch = API.run_job('branch.get', "music")
|
||||
# print(branch)
|
||||
|
|
@ -199,3 +199,11 @@ print(profile)
|
|||
# post_path="/post/1775143460-ef45186a",
|
||||
# parent_path="/",
|
||||
# )))
|
||||
|
||||
|
||||
from trustcafeapiwrapper.wrappers.follow.follow import follow
|
||||
save_response(API.wrapped(follow(
|
||||
entity='userprofile',
|
||||
is_following=True,
|
||||
parent_slug='alphaemail-test2'
|
||||
)))
|
||||
|
|
@ -20,4 +20,24 @@ class TestFollow(unittest.TestCase):
|
|||
self.assertIn("followType", result["payload"])
|
||||
self.assertIn("preferences", result["payload"])
|
||||
self.assertEqual(result["payload"]["isFollowing"], True)
|
||||
self.assertEqual(result["payload"]["parentSlug"], "janedoe")
|
||||
self.assertEqual(result["payload"]["parent"]["pk"], "userprofile#janedoe")
|
||||
|
||||
def test_unfollow(self):
|
||||
|
||||
result = follow(
|
||||
entity='user',
|
||||
is_following=False,
|
||||
parent_slug='janedoe'
|
||||
)
|
||||
|
||||
self.assertIsInstance(result, dict)
|
||||
self.assertIn("job_function", result)
|
||||
self.assertIn("payload", result)
|
||||
self.assertEqual(result["job_function"], "follow.follow")
|
||||
self.assertIsInstance(result["payload"], dict)
|
||||
self.assertIn("isFollowing", result["payload"])
|
||||
self.assertIn("parent", result["payload"])
|
||||
self.assertIn("followType", result["payload"])
|
||||
self.assertIn("preferences", result["payload"])
|
||||
self.assertEqual(result["payload"]["isFollowing"], False)
|
||||
Loading…
Add table
Add a link
Reference in a new issue