def update_relationship(self, ident, action):

        if not ident in self.testdata:
            raise nose.SkipTest("missing configuration for %s user" % ident)

        group_id = self.testdata['group']['xid']
        user_id = self.testdata[ident]['xid']

        typepad.client.batch_request()
        group = typepad.Group.get_by_url_id(group_id)
        typepad.client.complete_batch()

        typepad.client.batch_request()
        user = typepad.User.get_by_url_id(user_id)
        memberships = user.memberships.filter(by_group=group)
        typepad.client.complete_batch()

        self.assertValidUser(user)
        self.assert_(len(memberships) == 1)
        self.assertValidRelationship(memberships[0])
        self.assertEquals(memberships[0].source.url_id, group_id)

        if action == 'block':
            self.assert_(not memberships[0].is_blocked())
            memberships[0].block()
        elif action == 'unblock':
            self.assert_(memberships[0].is_blocked())
            status = typepad.RelationshipStatus.get(memberships[0].status_obj._location, batch=False)
            status.types = ["tag:api.typepad.com,2009:Member"]
            status.put()

        typepad.client.batch_request()
        new_membership = user.memberships.filter(by_group=group)
        typepad.client.complete_batch()

        self.assert_(len(new_mebership) == 1)
        self.assertValidRelationship(new_membership[0])

        # confirm relationship now reflects status we expect
        if action == 'block':
            self.assert_(new_membership[0].is_blocked())
            self.assert_(not new_membership[0].is_member())
        elif action == 'unblock':
            self.assert_(not new_membership[0].is_blocked())
            self.assert_(new_membership[0].is_member())
Updates the group relationship of a particular user.
dataset/ETHPy150Open typepad/python-typepad-api/tests/test_typepad.py/TestGroup.update_relationship