@pytest.mark.django_db
def test_sync(project0_nongnu, project0, store0):
 tp = TranslationProjectFactory(project=project0, language=LanguageDBFactory())
 store = StoreDBFactory(translation_project=tp, parent=tp.directory)
 store.update(store.deserialize(store0.serialize()))
 assert (not store.file.exists())
 store.sync()
 assert store.file.exists()
 os.remove(store.file.path)
 assert (not store.file.exists())
 store.sync()
 assert store.file.exists()

@ pytest . mark . django_db def test_sync ( project0_nongnu , project0 , store0 ) : tp = TranslationProjectFactory ( project = project0 , language = LanguageDBFactory ( ) ) store = StoreDBFactory ( translation_project = tp , parent = tp . directory ) store . update ( store . deserialize ( store0 . serialize ( ) ) ) assert ( not store . file . exists ( ) ) store . sync ( ) assert store . file . exists ( ) os . remove ( store . file . path ) assert ( not store . file . exists ( ) ) store . sync ( ) assert store . file . exists ( )
tests that the new on-disk file is created after sync for existing in-db store if the corresponding on-disk file ceased to exist .