Exemplo n.º 1
0
 def cli(self, request):
     tmpdir = tempfile.mkdtemp()
     request.addfinalizer(lambda: shutil.rmtree(tmpdir))
     cli = _make_cli(tmpdir, request)
     cli.setup_test_library()
     cli.run_test('build', 'course1')
     return cli
Exemplo n.º 2
0
def test_module(cli):
    cli.create_library()
    cli.run_test('module', 'newmod')
    moddir = cli.library.module_path.child('newmod')
    assert moddir.exists()
    assert ls(moddir) == ['exercises', 'module.yaml']
    assert ls(moddir.child('exercises')) == ['newmod.txt']
Exemplo n.º 3
0
    def test_deploy(self, cli, monkeypatch):

        # Mock out envoy.run, tracking commands for later checking.
        run_commands = []

        def monkeyrun(cmd):
            class rv(object):
                status_code = 0
            run_commands.append(cmd)
            return rv()
        monkeypatch.setattr(chucks.cli.envoy, 'run', monkeyrun)

        cli.run_test('deploy')
        assert run_commands == [
            'git init',
            'git add .',
            'git commit -m "deploy"',
            'git remote add heroku [email protected]:myapp.git',
            'git push --force heroku master',
        ]
Exemplo n.º 4
0
def test_course(cli):
    cli.create_library()
    cli.run_test('module', 'mod1')
    cli.run_test('module', 'mod2')
    cli.run_test('course', 'newcourse')
    assert ls(cli.library.course_path) == ['newcourse.yaml']
    course = yaml.load(open(cli.library.course_path.child('newcourse.yaml')))
    assert course['modules'] == ['mod1', 'mod2']