-
Notifications
You must be signed in to change notification settings - Fork 22
/
test.py
39 lines (31 loc) · 1.19 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from instabot import User, api, Sender, Getter
import logging.config
import unittest
from instabot.user.user_controller import UserController
class TestUser(unittest.TestCase):
def test_getter(self):
get = Getter()
print ("USERS AVAILABLE: %d" % get.controller.queue.qsize())
resp = list(get.user_followers("4456846295"))
self.assertTrue(len(resp) > 0)
resp = list(get.user_following("4456846295", total=5))
self.assertEqual(len(resp), 5)
resp = list(get.user_feed("4456846295", total=10))
self.assertEqual(len(resp), 10)
resp = get.user_info("4456846295")
self.assertEqual(resp["pk"], 4456846295)
resp = get.user_info("ohld")
self.assertEqual(resp["pk"], 352300017)
resp = list(get.liked_media(total=0))
self.assertEqual(len(resp), 0)
def test_sender(self):
send = Sender("instabotproject")
self.assertTrue(send.can_follow("ohld"))
self.assertFalse(send.follow_followers("ohld", total=1))
def add_users():
pass
if __name__ == '__main__':
logging.config.fileConfig('instabot/log.conf')
log = logging.getLogger('main')
# add_users()
unittest.main()