Exemplo n.º 1
0
 def test_scummvm_script_requires_game_id(self):
     installer = {
         'runner': "scummvm",
         'game': {}
     }
     validator = ScriptValidator(installer)
     self.assertFalse(validator.is_valid())
     self.assertIn("ScummVM game should have a "
                   "game identifier in the 'game' section",
                   validator.errors)
Exemplo n.º 2
0
 def clean(self):
     dummy_installer = models.Installer(game=self.instance.game,
                                        **self.cleaned_data)
     validator = ScriptValidator(dummy_installer.as_dict())
     if not validator.is_valid():
         if 'content' not in self.errors:
             self.errors['content'] = []
         for error in validator.errors:
             self.errors['content'].append(error)
         raise forms.ValidationError("Invalid installer script")
     else:
         return self.cleaned_data
Exemplo n.º 3
0
 def test_files_must_not_be_dict(self):
     installer = {'files': {}}
     validator = ScriptValidator(installer)
     self.assertFalse(validator.is_valid())
Exemplo n.º 4
0
 def test_files_should_be_list(self):
     installer = {'files': []}
     validator = ScriptValidator(installer)
     self.assertTrue(validator.is_valid())