@pytest.mark.django_db
def test_add_store_bad(po_directory, english):
 project0 = Project.objects.get(code='project0')
 project = ProjectDBFactory(source_language=english)
 with pytest.raises(ValidationError):
  StoreFS.objects.create(pootle_path='/en/project0_BAD/example.po', path='/some/fs/example.po')
 with pytest.raises(ValidationError):
  StoreFS.objects.create(project=project0, pootle_path=('/en/%s/en.po' % project.code), path='/locales/en.po')
 with pytest.raises(ValidationError):
  StoreFS.objects.create(project=project0, pootle_path=('/language0/%s/en.po' % project0.code))
 with pytest.raises(ValidationError):
  StoreFS.objects.create(project=project0, path='/locales/en.po')
 store = setup_store('/language0/project0/en.po')
 with pytest.raises(ValidationError):
  StoreFS.objects.create(store=store, pootle_path=store.pootle_path)

@ pytest . mark . django_db def test_add_store_bad ( po_directory , english ) : project0 = Project . objects . get ( code = 'project0' ) project = ProjectDBFactory ( source_language = english ) with pytest . raises ( ValidationError ) : StoreFS . objects . create ( pootle_path = '/en/project0_BAD/example.po' , path = '/some/fs/example.po' ) with pytest . raises ( ValidationError ) : StoreFS . objects . create ( project = project0 , pootle_path = ( '/en/%s/en.po' % project . code ) , path = '/locales/en.po' ) with pytest . raises ( ValidationError ) : StoreFS . objects . create ( project = project0 , pootle_path = ( '/language0/%s/en.po' % project0 . code ) ) with pytest . raises ( ValidationError ) : StoreFS . objects . create ( project = project0 , path = '/locales/en.po' ) store = setup_store ( '/language0/project0/en.po' ) with pytest . raises ( ValidationError ) : StoreFS . objects . create ( store = store , pootle_path = store . pootle_path )
try to create a store_fs by pootle_path for a non existent project .