def test_listener_disconnecting(self): # this test simply ensures the default behavior detach_relationship_listener() # have john start blocking paul self.john.relationships.add(self.paul, self.blocking) # the blocking relationship is created and the original following # relationship is left intact self.assertQuerysetEqual(self.john.relationships.blocking(), [self.paul]) self.assertQuerysetEqual(self.john.relationships.following(), [self.paul, self.yoko]) # have paul start following john self.paul.relationships.add(self.john, self.following) # the following relationship is created and the original blocking # relationship is left intact self.assertQuerysetEqual(self.paul.relationships.following(), [self.john]) self.assertQuerysetEqual(self.paul.relationships.blocking(), [self.john])
def tearDown(self): detach_relationship_listener() BaseRelationshipsTestCase.tearDown(self)