Example #1
0
    def testSample(self):
        u1 = User.new(self.g, {"id": "CH"})
        u2 = User.new(self.g, {"id": "Cl"})
        u3 = User.new(self.g, {"id": "C"})

        users = User.sample(self.g, n=2)
        self.assertEqual(len(users), 2)
Example #2
0
    def testSample(self):
        u1 = User.new(self.g, {"id": "CH"})
        u2 = User.new(self.g, {"id": "Cl"})
        u3 = User.new(self.g, {"id": "C"})

        users = User.sample(self.g, n=2)
        self.assertEqual(len(users), 2)
Example #3
0
    def testGetFollowerTweets(self):

        mu = User.new(self.g, {"id": 1234, "screen_name": "member"})
        u = mu.add_followers([
            {
                "id": 2345,
                "screen_name": "follower"
            },
        ])[0]
        u.add_tweets([
            {
                "id": 1,
                "text": "tw0"
            },
            {
                "id": 2,
                "text": "tw1"
            },
            {
                "id": 3,
                "text": "tw2"
            },
            {
                "id": 4,
                "text": "tw3"
            },
        ])

        result = set(t["text"] for t in mu.get_follower_tweets())
        self.assertEqual(result, set(["tw0", "tw1", "tw2", "tw3"]))
Example #4
0
    def testGetTweets(self):
        u = User.new(self.g, {"id": "CH"})
        u.add_tweets([
            {"id":1, "text":"tw0"},
            {"id":2, "text":"tw1"},
            {"id":3, "text":"tw2"},
            {"id":4, "text":"tw3"},
        ])

        result = set(t["text"] for t in u.get_tweets())
        self.assertEqual(result, set(["tw0", "tw1", "tw2", "tw3"]))
Example #5
0
    def testGetFollowerTweets(self):

        mu = User.new(self.g, {"id":1234, "screen_name":"member"})
        u =mu.add_followers( [{"id": 2345, "screen_name":"follower"}, ])[0]
        u.add_tweets([
            {"id":1, "text":"tw0"},
            {"id":2, "text":"tw1"},
            {"id":3, "text":"tw2"},
            {"id":4, "text":"tw3"},
            ])

        result = set(t["text"] for t in mu.get_follower_tweets())
        self.assertEqual(result, set(["tw0", "tw1", "tw2", "tw3"]))
Example #6
0
    def testGetTweets(self):
        u = User.new(self.g, {"id": "CH"})
        u.add_tweets([
            {
                "id": 1,
                "text": "tw0"
            },
            {
                "id": 2,
                "text": "tw1"
            },
            {
                "id": 3,
                "text": "tw2"
            },
            {
                "id": 4,
                "text": "tw3"
            },
        ])

        result = set(t["text"] for t in u.get_tweets())
        self.assertEqual(result, set(["tw0", "tw1", "tw2", "tw3"]))
Example #7
0
 def testAddNewUser(self):
     u = User.new(self.g, properties=self.USER_DATA)
     u.get_followers()
Example #8
0
 def testGraphPush(self):
     u = User.new(self.g, {"id": 1234, "name": "Froo Froo"})
     u.push()
Example #9
0
 def testAddUserWithExtraAttrs(self):
     u0 = User.new(self.g, {"id": 123456, "screen_name": "fluffer1"})
     u1 = User.find_one(self.g, {"screen_name": "fluffer1"})
     self.assertEqual(u0, u1)
Example #10
0
    def testMergeUser(self):
        u0 = User.new(self.g, {"id": 123456, "screen_name": "fluffer1"})
        u1 = User.new(self.g, {"id": 123456})

        self.assertEqual(u0["screen_name"], u1["screen_name"])
        self.assertEqual(u1["screen_name"], "fluffer1")
Example #11
0
 def testInvalidUser(self):
     with self.assertRaises(MissingProperty):
         User.new(self.g, {"fod": "foo"})
Example #12
0
 def testGraphPush(self):
     u = User.new(self.g, {"id": 1234, "name": "Froo Froo"})
     u.push()
Example #13
0
 def testAddUserWithExtraAttrs(self):
     u0 = User.new(self.g, {"id": 123456, "screen_name": "fluffer1"})
     u1 = User.find_one(self.g, {"screen_name": "fluffer1"})
     self.assertEqual(u0, u1)
Example #14
0
    def testMergeUser(self):
        u0 = User.new(self.g, {"id": 123456, "screen_name": "fluffer1"})
        u1 = User.new(self.g, {"id": 123456})

        self.assertEqual(u0["screen_name"], u1["screen_name"])
        self.assertEqual(u1["screen_name"], "fluffer1")
Example #15
0
 def testInvalidUser(self):
     with self.assertRaises(MissingProperty):
         User.new(self.g, {"fod": "foo"})
Example #16
0
 def testAddNewUser(self):
     u = User.new(self.g, properties=self.USER_DATA)
     u.get_followers()