def test_it_is_callable(self):
     ctx = MockContext(run=[
         Result('gem install jekyll result'),
         Result('jekyll version result'),
         Result('jekyll build result'),
     ])
     build_jekyll(ctx,
                  branch='branch',
                  owner='owner',
                  repository='repo',
                  site_prefix='site/prefix',
                  config='boop: beep',
                  base_url='/site/prefix')
 def test_gemfile_is_used_if_it_exists(self, monkeypatch, patch_clone_dir):
     monkeypatch.setattr(tasks.build, 'SITE_BUILD_DIR_PATH', '/boop')
     create_file(patch_clone_dir / GEMFILE, '')
     ctx = MockContext(
         run={
             'gem install bundler  --version "<2"': Result(),
             'bundle install': Result(),
             'bundle exec jekyll -v': Result(),
             f'bundle exec jekyll build --destination /boop': Result(),
         })
     tasks.build_jekyll(ctx,
                        branch='branch',
                        owner='owner',
                        repository='repo',
                        site_prefix='site/prefix')
    def test_it_is_callable(self, patch_clone_dir):
        ctx = MockContext(run=[
            Result('gem install jekyll result'),
            Result('jekyll version result'),
            Result('jekyll build result'),
        ])

        contents = 'hi: test'
        create_file(patch_clone_dir / JEKYLL_CONFIG_YML, contents)
        tasks.build_jekyll(ctx,
                           branch='branch',
                           owner='owner',
                           repository='repo',
                           site_prefix='site/prefix',
                           config='boop: beep',
                           base_url='/site/prefix')
Ejemplo n.º 4
0
    def test_it_is_callable(self, fs):
        ctx = MockContext(run=[
            Result('gem install jekyll result'),
            Result('jekyll version result'),
            Result('jekyll build result'),
        ])

        with Patcher() as patcher:
            patcher.fs.CreateFile('/tmp/site_repo/_config.yml',
                                  contents='hi: test')

            build_jekyll(ctx,
                         branch='branch',
                         owner='owner',
                         repository='repo',
                         site_prefix='site/prefix',
                         config='boop: beep',
                         base_url='/site/prefix')
    def test_jekyll_build_is_called_correctly(self, patch_clone_dir):
        ctx = MockContext()
        ctx.run = Mock()

        conf_path = patch_clone_dir / JEKYLL_CONFIG_YML
        conf_contents = 'hi: test'
        create_file(conf_path, conf_contents)

        tasks.build_jekyll(ctx,
                           branch='branch',
                           owner='owner',
                           repository='repo',
                           site_prefix='site/prefix',
                           config='boop: beep',
                           base_url='/site/prefix')

        assert ctx.run.call_count == 3

        jekyll_build_call_args = ctx.run.call_args_list[2]
        args, kwargs = jekyll_build_call_args

        # Make sure the call to jekyll build is correct
        assert args[0] == 'jekyll build --destination /work/site_repo/_site'

        # Make sure the env is as expected
        assert kwargs['env'] == {
            'BRANCH': 'branch',
            'OWNER': 'owner',
            'REPOSITORY': 'repo',
            'SITE_PREFIX': 'site/prefix',
            'BASEURL': '/site/prefix',
            'LANG': 'en_US.UTF-8',
            'JEKYLL_ENV': 'production'
        }

        # Check that the config file has had baseurl, branch, and custom
        # config added
        with conf_path.open() as f:
            assert f.read() == ('hi: test\nbaseurl: /site/prefix\n'
                                'branch: branch\nboop: beep\n')
Ejemplo n.º 6
0
    def test_jekyll_build_is_called_correctly(self, fs):
        ctx = MockContext(run=[
            Result('gem install jekyll result'),
            Result('jekyll version result'),
            Result('jekyll build result'),
        ])

        ctx.run = Mock()

        with Patcher() as patcher:
            patcher.fs.CreateFile('/tmp/site_repo/_config.yml',
                                  contents='hi: test')

            build_jekyll(ctx,
                         branch='branch',
                         owner='owner',
                         repository='repo',
                         site_prefix='site/prefix',
                         config='boop: beep',
                         base_url='/site/prefix')

            assert ctx.run.call_count == 3

            jekyll_build_call_args = ctx.run.call_args_list[2]
            args, kwargs = jekyll_build_call_args

            # Make sure the call to jekyll build is correct
            assert args[0] == 'jekyll build --destination /tmp/site_repo/_site'

            # Make sure the env is as expected
            assert kwargs['env'] == {
                'BRANCH': 'branch',
                'OWNER': 'owner',
                'REPOSITORY': 'repo',
                'SITE_PREFIX': 'site/prefix',
                'BASEURL': '/site/prefix',
                'LANG': 'en_US.UTF-8',
                'JEKYLL_ENV': 'production'
            }