def test_add_store_bad(fs_plugin, other_project): """Try to create a store_fs by pootle_path for a non existent project """ # project doesnt exist with pytest.raises(ValidationError): StoreFS.objects.create( pootle_path="/en/tutorial_BAD/example.po", path="/some/fs/example.po") # project has not fs plugin set up with pytest.raises(ValidationError): StoreFS.objects.create( project=other_project, pootle_path="/en/other_project/en.po", path="/locales/en.po") # pootle_path must match project_code with pytest.raises(ValidationError): StoreFS.objects.create( project=fs_plugin.project, pootle_path="/en/other_project/en.po", path="/locales/en.po") # need both pootle_path and fs_path - somehow with pytest.raises(ValidationError): StoreFS.objects.create( project=fs_plugin.project, pootle_path="/en/tutorial/en.po") with pytest.raises(ValidationError): StoreFS.objects.create( project=fs_plugin.project, path="/locales/en.po") store = _setup_store("/en/tutorial/en.po") with pytest.raises(ValidationError): StoreFS.objects.create( store=store, pootle_path=store.pootle_path)
PLUGIN_STATUS = OrderedDict() PLUGIN_STATUS["conflict_untracked"] = ( lambda plugin: _create_conflict(plugin), {"conflict_untracked": [(u"/en/tutorial/subdir3/subsubdir/example5.po", "/non_gnu_style/locales/en/subsubdir/example5.po")]}) PLUGIN_STATUS["fs_unmatched"] = ( lambda plugin: _edit_file(plugin, "foo.po"), {}) PLUGIN_STATUS["fs_untracked"] = ( lambda plugin: _edit_file( plugin, "/non_gnu_style/locales/en/subsubdir/example5.po"), {"fs_untracked": [(u"/en/tutorial/subdir3/subsubdir/example5.po", "/non_gnu_style/locales/en/subsubdir/example5.po")]}) PLUGIN_STATUS["pootle_untracked"] = ( lambda plugin: _setup_store("/en/tutorial/subdir3/subsubdir/example5.po"), {"pootle_untracked": [(u"/en/tutorial/subdir3/subsubdir/example5.po", "/non_gnu_style/locales/en/subsubdir/example5.po")]}) PLUGIN_STATUS["fs_added"] = ( lambda plugin: ( _edit_file( plugin, "/non_gnu_style/locales/en/subsubdir/example5.po"), plugin.fetch_translations()), {"fs_added": [(u"/en/tutorial/subdir3/subsubdir/example5.po", "/non_gnu_style/locales/en/subsubdir/example5.po")]}) PLUGIN_STATUS["pootle_added"] = ( lambda plugin: ( _setup_store("/en/tutorial/subdir3/subsubdir/example5.po"), plugin.add_translations()),
PLUGIN_STATUS = OrderedDict() PLUGIN_STATUS["conflict_untracked"] = ( lambda plugin: _create_conflict(plugin), { "conflict_untracked": [(u"/en/tutorial/subdir3/subsubdir/example5.po", "/non_gnu_style/locales/en/subsubdir/example5.po")] }) PLUGIN_STATUS["fs_unmatched"] = (lambda plugin: _edit_file(plugin, "foo.po"), {}) PLUGIN_STATUS["fs_untracked"] = (lambda plugin: _edit_file( plugin, "/non_gnu_style/locales/en/subsubdir/example5.po"), { "fs_untracked": [(u"/en/tutorial/subdir3/subsubdir/example5.po", "/non_gnu_style/locales/en/subsubdir/example5.po")] }) PLUGIN_STATUS["pootle_untracked"] = ( lambda plugin: _setup_store("/en/tutorial/subdir3/subsubdir/example5.po"), { "pootle_untracked": [(u"/en/tutorial/subdir3/subsubdir/example5.po", "/non_gnu_style/locales/en/subsubdir/example5.po")] }) PLUGIN_STATUS["fs_added"] = ( lambda plugin: (_edit_file(plugin, "/non_gnu_style/locales/en/subsubdir/example5.po"), plugin.fetch_translations()), { "fs_added": [(u"/en/tutorial/subdir3/subsubdir/example5.po", "/non_gnu_style/locales/en/subsubdir/example5.po")] }) PLUGIN_STATUS["pootle_added"] = ( lambda plugin: (_setup_store("/en/tutorial/subdir3/subsubdir/example5.po"), plugin.add_translations()), {