コード例 #1
0
    def setUp(self):
        super(PostableTest, self).setUp()

        self.userdata = {"objectType": "person", "id": "acct:[email protected]"}
        self.collectiondata = {"objectType": "collection", "id": "http://activityschema.org/collection/public"}

        self.testuser = self.pump.Person().unserialize(self.userdata)
        self.testcollection = self.pump.Collection().unserialize(self.collectiondata)

        self.postable = Postable()
        self.postable._pump = self.pump
コード例 #2
0
class PostableTest(PyPumpTest):
    def setUp(self):
        super(PostableTest, self).setUp()

        self.userdata = {"objectType": "person", "id": "acct:[email protected]"}
        self.collectiondata = {"objectType": "collection", "id": "http://activityschema.org/collection/public"}

        self.testuser = self.pump.Person().unserialize(self.userdata)
        self.testcollection = self.pump.Collection().unserialize(self.collectiondata)

        self.postable = Postable()
        self.postable._pump = self.pump

    def test_set_person(self):
        self.postable.to = self.testuser
        # is list item a pump person?
        self.assertTrue(isinstance(self.postable.to[0], type(self.pump.Person())))

    def test_set_collection(self):
        self.postable.to = self.testcollection
        # is list item a pump collection?
        self.assertTrue(isinstance(self.postable.to[0], type(self.pump.Collection())))

    def test_serialize(self):
        self.postable.to = [self.testuser, self.testcollection]

        data = self.postable.serialize()

        self.assertEqual(data["to"][0], self.userdata)
        self.assertEqual(data["to"][1], self.collectiondata)
コード例 #3
0
ファイル: postable_test.py プロジェクト: kylewm/PyPump
class PostableTest(PyPumpTest):
    
    def setUp(self):
        super(PostableTest, self).setUp()

        self.userdata = {"objectType" : "person",
                         "id" : "acct:[email protected]"}
        self.collectiondata = {"objectType" : "collection", 
                               "id" : "http://activityschema.org/collection/public"}

        self.testuser = self.pump.Person().unserialize(self.userdata)
        self.testcollection = self.pump.Collection().unserialize(self.collectiondata)

        self.postable = Postable()
        self.postable._pump = self.pump

    def test_set_person(self):
        self.postable.to = self.testuser
        #is list item a pump person?
        self.assertTrue(isinstance(self.postable.to[0], type(self.pump.Person())))

    def test_set_collection(self):
        self.postable.to = self.testcollection
        #is list item a pump collection?
        self.assertTrue(isinstance(self.postable.to[0], type(self.pump.Collection())))

    def test_serialize(self):
        self.postable.to = [self.testuser, self.testcollection]

        data = self.postable.serialize()

        self.assertEqual(data["to"][0], self.userdata)
        self.assertEqual(data["to"][1], self.collectiondata)
コード例 #4
0
ファイル: postable_test.py プロジェクト: kylewm/PyPump
    def setUp(self):
        super(PostableTest, self).setUp()

        self.userdata = {"objectType" : "person",
                         "id" : "acct:[email protected]"}
        self.collectiondata = {"objectType" : "collection", 
                               "id" : "http://activityschema.org/collection/public"}

        self.testuser = self.pump.Person().unserialize(self.userdata)
        self.testcollection = self.pump.Collection().unserialize(self.collectiondata)

        self.postable = Postable()
        self.postable._pump = self.pump