@pytest.mark.django_db
def test_delete_mark_obsolete(project0_nongnu, project0, store0):
 tp = TranslationProjectFactory(project=project0, language=LanguageDBFactory())
 store = StoreDBFactory(translation_project=tp, parent=tp.directory)
 store.update(store.deserialize(store0.serialize()))
 store.sync()
 pootle_path = store.pootle_path
 os.remove(store.file.path)
 tp.scan_files()
 updated_store = Store.objects.get(pootle_path=pootle_path)
 assert updated_store.obsolete
 assert (not updated_store.units.exists())
 assert updated_store.unit_set.filter(state=OBSOLETE).exists()

@ pytest . mark . django_db def test_delete_mark_obsolete ( project0_nongnu , project0 , store0 ) : tp = TranslationProjectFactory ( project = project0 , language = LanguageDBFactory ( ) ) store = StoreDBFactory ( translation_project = tp , parent = tp . directory ) store . update ( store . deserialize ( store0 . serialize ( ) ) ) store . sync ( ) pootle_path = store . pootle_path os . remove ( store . file . path ) tp . scan_files ( ) updated_store = Store . objects . get ( pootle_path = pootle_path ) assert updated_store . obsolete assert ( not updated_store . units . exists ( ) ) assert updated_store . unit_set . filter ( state = OBSOLETE ) . exists ( )
tests that the in-db store and directory are marked as obsolete after the on-disk file ceased to exist .