Ejemplo n.º 1
0
    def test_validate_config(self):
        signer = self.new_file(name="signer", contents="#!/bin/bash").path
        os.chmod(signer, 0o755)

        repo = mock.MagicMock(id="repo-1")
        conduit = self._config_conduit()
        config = dict(http=True, https=False, relative_url=None,
                      gpg_cmd=signer)
        distributor = self.Module.DebDistributor()
        self.assertEquals(
            distributor.validate_config(repo, config, conduit),
            (True, None))
Ejemplo n.º 2
0
 def test_validate_config_empty(self):
     repo = mock.MagicMock(id="repo-1")
     conduit = self._config_conduit()
     config = {}
     distributor = self.Module.DebDistributor()
     self.assertEquals(
         (False, '\n'.join([
             'Configuration key [http] is required, but was not provided',
             'Configuration key [https] is required, but was not provided',
             'Configuration key [relative_url] is required, but was not provided',  # noqa
             'Settings serve via http and https are both set to false. At least one option should be set to true.',  # noqa
         ])),
         distributor.validate_config(repo, config, conduit))
Ejemplo n.º 3
0
    def test_validate_config_bad_signer(self):
        # Signer is not an executable
        signer = self.new_file(name="signer", contents="#!/bin/bash").path

        repo = mock.MagicMock(id="repo-1")
        conduit = self._config_conduit()
        config = dict(http=True, https=False, relative_url=None,
                      gpg_cmd=signer)
        distributor = self.Module.DebDistributor()
        self.assertEquals(
            (False, '\n'.join([
                "Command %s is not executable" % signer,
            ])),
            distributor.validate_config(repo, config, conduit))