def test_read_write(self):
        expected = User(Identity('openid1', 'OpenID'))

        writer = UserWriter()
        xml_string = writer.write(expected)

        self.assertIsNotNone(xml_string)
        self.assertTrue(len(xml_string) > 0)

        reader = UserReader()
        actual = reader.read(xml_string)

        self.assertIsNotNone(actual)
        self.assertEqual(actual.user_id.type, expected.user_id.type)
        self.assertEqual(actual.user_id.name, expected.user_id.name)
    def test_read_write(self):
        expected = User('ivo://bar.com/user?00000000-0000-0000-0000-000000000f00')
        expected.identities.add(Identity('*****@*****.**', 'OpenID'))
        expected.identities.add(Identity('foo', 'HTTP'))
        expected.identities.add(Identity('00000000-0000-0000-0000-000000000004', 'CADC'))
        expected.identities.add(Identity('cn=foo,c=bar', 'X500'))

        writer = UserWriter()
        xml_string = writer.write(expected)

        self.assertIsNotNone(xml_string)
        self.assertTrue(len(xml_string) > 0)

        reader = UserReader()
        actual = reader.read(xml_string)

        self.assertIsNotNone(actual)
        self.assertEqual(actual.internal_id, expected.internal_id)
        self.assertSetEqual(expected.identities, actual.identities)
Ejemplo n.º 3
0
    def test_read_write(self):
        expected = User(
            'ivo://bar.com/user?00000000-0000-0000-0000-000000000f00')
        expected.identities.add(Identity('*****@*****.**', 'OpenID'))
        expected.identities.add(Identity('foo', 'HTTP'))
        expected.identities.add(
            Identity('00000000-0000-0000-0000-000000000004', 'CADC'))
        expected.identities.add(Identity('cn=foo,c=bar', 'X500'))

        writer = UserWriter()
        xml_string = writer.write(expected)

        self.assertIsNotNone(xml_string)
        self.assertTrue(len(xml_string) > 0)

        reader = UserReader()
        actual = reader.read(xml_string)

        self.assertIsNotNone(actual)
        self.assertEqual(actual.internal_id, expected.internal_id)
        self.assertSetEqual(expected.identities, actual.identities)