def test_minimal_read_write(self):

        group1 = Group('groupID_1')
        group2 = Group('groupID_2')
        owner1 = User(
            'ivo://cadc.nrc.ca/user?00000000-0000-0000-0000-00000000000a')
        owner2 = User(
            'ivo://cadc.nrc.ca/user?00000000-0000-0000-0000-00000000000b')
        group1.owner = owner1
        group2.owner = owner2
        expected = [group1, group2]

        writer = GroupsWriter()
        xml_string = writer.write(expected, False)

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

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

        self.assertIsNotNone(actual)
        self.assertTrue(len(actual) == 2)
        self.assertTrue(group1 in actual)
        self.assertTrue(group2 in actual)
    def test_empty_groups(self):

        expected = []

        writer = GroupsWriter()
        xml_string = writer.write(expected, True)

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

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

        self.assertIsNotNone(actual)
        self.assertTrue(len(actual) == 0)
    def test_empty_groups(self):

        expected = []

        writer = GroupsWriter()
        xml_string = writer.write(expected, True)

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

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

        self.assertIsNotNone(actual)
        self.assertTrue(len(actual) == 0)
    def test_minimal_read_write(self):

        group1 = Group('groupID_1')
        group2 = Group('groupID_2')
        owner1 = User('ivo://cadc.nrc.ca/user?00000000-0000-0000-0000-00000000000a')
        owner2 = User('ivo://cadc.nrc.ca/user?00000000-0000-0000-0000-00000000000b')
        group1.owner = owner1
        group2.owner = owner2
        expected = [group1, group2]

        writer = GroupsWriter()
        xml_string = writer.write(expected, False)

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

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

        self.assertIsNotNone(actual)
        self.assertTrue(len(actual) == 2)
        self.assertTrue(group1 in actual)
        self.assertTrue(group2 in actual)