Example #1
0
    def test_should_return_FileRemote_if_path_source(self):
        cfg = Config(Source.path('/ostree/repo'), 'ref')

        steps = get_steps(cfg)

        self.assertEqual(len(steps), 1)
        self.assertIsInstance(steps[0], FileRemote)
Example #2
0
    def test_should_add_ostree_remote_for_path_in_config(
            self, mock_run: mock.Mock):
        cfg = Config(Source.path('/srv/ostree/debian/repo'),
                     'debian/9/i386/desktop',
                     remote='remote-name')

        FileRemote(cfg).run()

        mock_run.assert_called_once_with([
            'ostree', 'remote', 'add',
            '--repo=%s' % os.path.join('/ostree', 'repo'), '--no-gpg-verify',
            'remote-name', 'file:///srv/ostree/debian/repo'
        ],
                                         check=True)
Example #3
0
    def test_should_add_ostree_remote_with_absolute_path(
            self, mock_run: mock.Mock):
        cfg = Config(Source.path('repo'),
                     'debian/9/i386/desktop',
                     remote='remote-name',
                     base_dir='ostree')
        repo_abs_path = os.path.join(os.getcwd(), 'ostree', 'repo')

        FileRemote(cfg).run()

        mock_run.assert_called_once_with([
            'ostree', 'remote', 'add',
            '--repo=%s' % os.path.join('/ostree', 'repo'), '--no-gpg-verify',
            'remote-name',
            'file://%s' % repo_abs_path
        ],
                                         check=True)