Beispiel #1
0
 def test_disable_not_enabled(self):
     """Disabling mirror when not configured is a no-op."""
     paths = get_paths(root_dir=Path(self.fakes.fs.root.path))
     config = paths['config']
     disable_mirroring(get_paths=lambda: paths)
     self.assertFalse(config.exists())
     self.assertFalse(config.with_suffix('.disabled').exists())
Beispiel #2
0
 def test_disable_twice(self):
     """disable_mirroring can be called multiple times."""
     paths = get_paths(root_dir=Path(self.fakes.fs.root.path))
     config = paths['config']
     disable_mirroring(get_paths=lambda: paths)
     disable_mirroring(get_paths=lambda: paths)
     self.assertFalse(config.exists())
     self.assertFalse(config.with_suffix('.disabled').exists())
Beispiel #3
0
    def test_disable_mirroring(self):
        """disable_mirroring renames the script config file."""
        paths = make_reprepro_files(self.fakes.fs.root.path, mirrors)

        config = paths['config']
        self.assertTrue(config.exists())
        orig_content = config.read_text()
        disable_mirroring(get_paths=lambda: paths)
        self.assertFalse(config.exists())
        # The file is moved to .disabled
        disabled_file = config.with_suffix('.disabled')
        self.assertTrue(disabled_file.exists())
        self.assertEqual(orig_content, disabled_file.read_text())
    def test_disable_mirroring(self):
        """disable_mirroring renames the script config file."""
        paths = get_paths(root_dir=Path(self.fakes.fs.root.path))
        uri = 'https://*****:*****@example.com/ubuntu xenial main universe'
        configure_reprepro(uri,
                           'i386 amd64',
                           'ABABABAB',
                           'CDCDCDCD',
                           'very secret',
                           get_paths=lambda: paths)

        config = paths['config']
        self.assertTrue(config.exists())
        orig_content = config.read_text()
        disable_mirroring(get_paths=lambda: paths)
        self.assertFalse(config.exists())
        # The file is moved to .disabled
        disabled_file = config.with_suffix('.disabled')
        self.assertTrue(disabled_file.exists())
        self.assertEqual(orig_content, disabled_file.read_text())
Beispiel #5
0
def config_not_set():
    repository.disable_mirroring()
    hookenv.status_set('blocked',
                       'Not all required configs set, mirroring is disabled')