def test_content_diff(self): content_load1 = Mock() content_load2 = Mock() content_load1.is_binary = Mock(return_value=True) self.assertEquals(content_diff(content_load1, content_load2), "Unable to diff binary contents of base") content_load1.is_binary = Mock(return_value=False) content_load2.is_binary = Mock(return_value=True) self.assertEquals(content_diff(content_load1, content_load2), "Unable to diff binary contents of base")
def resource_diff_function(base, other): from biicode.common.model.content import content_diff from biicode.common.model.cells import cell_diff if not base: # New item base = (None, None) if not other: # Deleted item other = (None, None) rdiff = cell_diff(base[0], other[0]) cdiff = content_diff(base[1], other[1]) return Resource(rdiff, cdiff)