43 lines
No EOL
1.7 KiB
Python
43 lines
No EOL
1.7 KiB
Python
import unittest
|
|
from trustcafeapiwrapper.wrappers.follow.follow import follow
|
|
|
|
class TestFollow(unittest.TestCase):
|
|
def test_follow(self):
|
|
|
|
result = follow(
|
|
entity='user',
|
|
is_following=True,
|
|
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"], 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) |