def test_scummvm_script_requires_game_id(self): script = json.dumps({'game': {}}) installer = Installer(runner=Runner(name="ScummVM", slug='scummvm'), content=script) is_valid, errors = validate_installer(installer) self.assertFalse(is_valid, errors) self.assertIn( "ScummVM game should have a " "game identifier in the 'game' section", errors)
def new_installer(request, slug): game = get_object_or_404(models.Game, slug=slug) installer = Installer(game=game) installer.set_default_installer() form = InstallerForm(request.POST or None, instance=installer) if request.method == "POST" and form.is_valid(): installer = form.save(commit=False) installer.game_id = game.id installer.user = request.user installer.save() notify_installer(installer) return redirect("installer_complete", slug=game.slug) return render( request, "installers/form.html", {"form": form, "game": game, "new": True} )
def new_installer(request, slug): game = get_object_or_404(models.Game, slug=slug) installer = Installer(game=game) installer.set_default_installer() form = InstallerForm(request.POST or None, instance=installer) if request.method == 'POST' and form.is_valid(): installer = form.save(commit=False) installer.game_id = game.id installer.user = request.user installer.save() return redirect("installer_complete", slug=game.slug) return render(request, 'installers/form.html', { 'form': form, 'game': game, 'new': True })
def new_installer(request, slug): game = get_object_or_404(models.Game, slug=slug) installer = Installer(game=game) installer.set_default_installer() form = InstallerForm(request.POST or None, instance=installer) if request.method == 'POST' and form.is_valid(): installer = form.save(commit=False) installer.game_id = game.id installer.user = request.user installer.save() return redirect("installer_complete", slug=game.slug) return render(request, 'games/installer-form.html', {'form': form, 'game': game, 'new': True})
def setUp(self): self.installer = Installer( runner=Runner(name="Linux"), version="test", )