Exemplo n.º 1
0
    def test_social_account_without_token_serialization(self):
        tokens = []

        social_account = SocialAccount("zcas", self.utc_datetime, self.utc_datetime, tokens, "zcc")

        serialized_social_account = social_account.serialize()
        self.assertEquals(SocialAccount.deserialize(serialized_social_account), social_account)
Exemplo n.º 2
0
    def test_social_account_serialization(self):
        tokens = [
            SocialAccountToken("xxzc", "zxcc", self.utc_datetime),
            SocialAccountToken("xxzc", "zxcc", self.utc_datetime),
        ]

        social_account = SocialAccount("zcas", self.utc_datetime, self.utc_datetime, tokens, "zcc")

        serialized_social_account = social_account.serialize()
        self.assertEquals(SocialAccount.deserialize(serialized_social_account), social_account)
Exemplo n.º 3
0
    def test_social_account_without_token_serialization(self):
        tokens = []

        social_account = SocialAccount("zcas",
                                       self.utc_datetime,
                                       self.utc_datetime,
                                       tokens,
                                       "zcc")

        serialized_social_account = social_account.serialize()
        self.assertEquals(SocialAccount.deserialize(serialized_social_account), social_account)
Exemplo n.º 4
0
    def test_social_account_serialization(self):
        tokens = [SocialAccountToken("xxzc", "zxcc", self.utc_datetime),
                  SocialAccountToken("xxzc", "zxcc", self.utc_datetime)]

        social_account = SocialAccount("zcas",
                                       self.utc_datetime,
                                       self.utc_datetime,
                                       tokens,
                                       "zcc")

        serialized_social_account = social_account.serialize()
        self.assertEquals(SocialAccount.deserialize(serialized_social_account), social_account)
Exemplo n.º 5
0
    def test_serialization(self):

        self.user.add_block(BRLBlock("laso/laso/block2/master"),
                            tags=["ONE", "TWO"],
                            description="The good block")
        self.user.add_block(BRLBlock("laso/laso/block3/master"))

        self.user.administrators.grant("pepito")
        self.user.administrators.grant("josete")

        tokens = [
            SocialAccountToken("xxzc", "zxcc", self.utc_datetime),
            SocialAccountToken("xxzc", "zxcc", self.utc_datetime)
        ]

        social_account = SocialAccount("zcas", self.utc_datetime,
                                       self.utc_datetime, tokens, "zcc")

        self.user.social_accounts = {"google": social_account}
        self.user.publish_counter = 10
        self.user.reuse_counter = 7
        self.user.read_api_counter = 99

        seri = self.user.serialize()
        user2 = User.deserialize(seri)
        self.assertTrue(self._user_equal(self.user, user2))
        self.assertEqual(user2.read_api_counter, 99)
        self.assertEqual(user2.reuse_counter, 7)
        self.assertEqual(user2.publish_counter, 10)
        self.assertEqual(set(user2.administrators), {"pepito", "josete"})

        self.assertEqual(self.user.region, "Madrid")