def test_exists_unknown_all(self): """If the repository sync-state is unknown, then it is considered to exist regardless of clean state. """ stat = ExternalStatus() stat.sync_state = ExternalStatus.UNKNOWN stat.clean_state = ExternalStatus.DEFAULT exists = stat.exists() self.assertTrue(exists) stat.clean_state = ExternalStatus.EMPTY exists = stat.exists() self.assertTrue(exists) stat.clean_state = ExternalStatus.UNKNOWN exists = stat.exists() self.assertTrue(exists) stat.clean_state = ExternalStatus.STATUS_OK exists = stat.exists() self.assertTrue(exists) stat.clean_state = ExternalStatus.DIRTY exists = stat.exists() self.assertTrue(exists)
def test_exists_empty_all(self): """If the repository sync-state is empty (doesn't exist), and there is no clean state, then it is considered not to exist. """ stat = ExternalStatus() stat.sync_state = ExternalStatus.EMPTY stat.clean_state = ExternalStatus.DEFAULT exists = stat.exists() self.assertFalse(exists) stat.clean_state = ExternalStatus.EMPTY exists = stat.exists() self.assertFalse(exists) stat.clean_state = ExternalStatus.UNKNOWN exists = stat.exists() self.assertFalse(exists) # this state represtens an internal logic error in how the # repo status was determined. stat.clean_state = ExternalStatus.STATUS_OK exists = stat.exists() self.assertTrue(exists) # this state represtens an internal logic error in how the # repo status was determined. stat.clean_state = ExternalStatus.DIRTY exists = stat.exists() self.assertTrue(exists)