コード例 #1
0
    def test_view_no_file(self):
        """ should fail if the file does not exist """

        support.create_project(self, 'reginald')

        viewed = self.get('/view/fake-file.html')
        self.assertEqual(viewed.flask.status_code, 204)
コード例 #2
0
    def test_jinja(self):
        """ should add jinja template to display """

        support.create_project(self, 'starbuck')

        project = cauldron.project.internal_project

        jinja_path = os.path.join(
            project.source_directory,
            'template.html'
        )

        with open(jinja_path, 'w') as fp:
            fp.write('<div>Hello {{ name }}</div>')

        step_contents = '\n'.join([
            'import cauldron as cd',
            'cd.display.jinja("{}", name="starbuck")'.format(
                jinja_path.replace('\\', '\\\\')
            )
        ])

        support.add_step(self, contents=step_contents)

        r = support.run_command('run')
        self.assertFalse(r.failed, 'should not have failed')
コード例 #3
0
    def test_run_no_step(self):
        """ should fail to run a None step """

        support.create_project(self, 'jefferson')
        project = cd.project.get_internal_project()
        result = source.run_step(Response(), project, 'FAKE.STEP')
        self.assertFalse(result)
コード例 #4
0
    def test_view(self):
        """ should return file data if file exists """

        support.create_project(self, 'renee')

        viewed = self.get('/view/project.html')
        self.assertEqual(viewed.flask.status_code, 200)
コード例 #5
0
    def test_watch_not_needed(self):
        """

        :return:
        """

        support.create_project(self, 'betty')
        support.add_step(self)
        project = cd.project.internal_project
        project.current_step = project.steps[0]

        self.assertFalse(
            reloading.refresh(mime_text),
            Message('Should not reload if the step has not been run before')
        )

        support.run_command('run')

        project.current_step = project.steps[0]

        self.assertFalse(
            reloading.refresh(mime_text),
            Message('Should not reload if module has not changed recently')
        )

        project.current_step = None
        support.run_command('close')
コード例 #6
0
ファイル: test_Project.py プロジェクト: larsrinn/cauldron
    def test_results_path(self):
        """Results path should always be valid"""

        def assert_valid_path(test: str) -> bool:
            return self.assertTrue(
                test is not None and
                len(test) > 0
            )

        support.create_project(self, 'dudley')
        project = cd.project.internal_project

        project._results_path = None
        assert_valid_path(project.results_path)

        results_directory = environ.configs.fetch('results_directory')
        environ.configs.put(results_directory=None, persists=False)

        assert_valid_path(project.results_path)

        project.settings.put('path_results', os.path.realpath('.'))
        assert_valid_path(project.results_path)

        project.settings.put('path_results', None)
        assert_valid_path(project.results_path)

        environ.configs.put(results_directory=results_directory, persists=False)

        support.run_command('close')
コード例 #7
0
ファイル: test_run.py プロジェクト: sernst/cauldron
    def test_single_step(self):
        """ should run single step only """

        support.create_project(self, 'white-bear-lake')
        support.add_step(self)
        support.add_step(self)
        support.add_step(self)

        project = cauldron.project.get_internal_project()

        r = run.execute(
            context=cli.make_command_context(name=run.NAME),
            single_step=True
        )

        self.assertFalse(r.failed)
        self.assertFalse(project.steps[0].is_dirty())
        self.assertTrue(project.steps[1].is_dirty())
        self.assertTrue(project.steps[2].is_dirty())

        r = run.execute(
            context=cli.make_command_context(name=run.NAME),
            single_step=True
        )

        self.assertFalse(r.failed)
        self.assertFalse(project.steps[0].is_dirty())
        self.assertFalse(project.steps[1].is_dirty())
        self.assertTrue(project.steps[2].is_dirty())
コード例 #8
0
    def test_change_title(self):
        """ should change title """

        support.create_project(self, 'blaine')
        support.add_step(self)

        project = cauldron.project.get_internal_project()

        r = Response()
        step_actions.modify_step(response=r,
                                 project=project,
                                 name=project.steps[0].filename,
                                 title='a')
        self.assertFalse(r.failed)
        self.assertEqual(project.steps[0].definition.title, 'a')

        r = Response()
        step_actions.modify_step(response=r,
                                 project=project,
                                 name=project.steps[0].filename,
                                 title='b')
        self.assertFalse(r.failed)
        self.assertEqual(project.steps[0].definition.title, 'b')

        r = Response()
        step_actions.modify_step(response=r,
                                 project=project,
                                 name=project.steps[0].filename,
                                 new_name='first')
        self.assertFalse(r.failed)
        self.assertEqual(project.steps[0].definition.title, 'b')
コード例 #9
0
    def test_no_such_file(self):
        """ should return a 204 status when no such file exists """

        support.create_project(self, 'project-downloader-1')

        downloaded = self.get('/project-download/fake.filename.not_real')
        self.assertEqual(downloaded.flask.status_code, 204)
コード例 #10
0
    def test_single_step(self):
        """ should run single step only """

        support.create_project(self, 'white-bear-lake')
        support.add_step(self)
        support.add_step(self)
        support.add_step(self)

        project = cauldron.project.get_internal_project()

        r = run.execute(context=cli.make_command_context(name=run.NAME),
                        single_step=True)

        self.assertFalse(r.failed)
        self.assertFalse(project.steps[0].is_dirty())
        self.assertTrue(project.steps[1].is_dirty())
        self.assertTrue(project.steps[2].is_dirty())

        r = run.execute(context=cli.make_command_context(name=run.NAME),
                        single_step=True)

        self.assertFalse(r.failed)
        self.assertFalse(project.steps[0].is_dirty())
        self.assertFalse(project.steps[1].is_dirty())
        self.assertTrue(project.steps[2].is_dirty())
コード例 #11
0
ファイル: test_runner.py プロジェクト: sernst/cauldron
    def test_exception(self):
        """
        """

        support.create_project(self, 'brad')
        support.add_step(
            self, 'brad_one.py', cli.reformat(
                """
                import cauldron as cd

                a = dict(
                    one=1,
                    two=['1', '2'],
                    three={'a': True, 'b': False, 'c': True}
                )

                cd.display.inspect(a)
                cd.shared.a = a
                cd.display.workspace()

                """
            )
        )
        support.add_step(self, 'brad_two.py', "1 + 's'")

        r = support.run_command('run .')
        self.assertFalse(r.failed, 'should not have failed')

        r = support.run_command('run .')
        self.assertTrue(r.failed, 'should have failed')
コード例 #12
0
    def test_no_existing_source_file(self):
        """ should succeed even if the step has no source file """

        support.create_project(self, 'richfield')
        support.add_step(self, 'first')

        project = cauldron.project.get_internal_project()
        step = project.steps[0]
        r = Response()

        self.assertTrue(
            systems.remove(step.source_path),
            'should have removed source file'
        )

        result = step_actions.modify_step(
            response=r,
            project=project,
            name=step.filename,
            new_name='solo',
            title='Only Step'
        )

        new_step = project.steps[0]
        self.assertTrue(result)
        self.assertTrue(os.path.exists(new_step.source_path))
コード例 #13
0
ファイル: test_sync_file.py プロジェクト: sernst/cauldron
    def test_valid_shared(self):
        """Should synchronize file remotely to shared library location."""
        support.create_project(self, 'peter-2')
        project = cauldron.project.get_internal_project()

        response = support.run_remote_command(
            'open "{}" --forget'.format(project.source_directory)
        )
        self.assert_no_errors(response)
        project = cauldron.project.get_internal_project()

        posted = self.post('/sync-file', {
            'relative_path': 'library/test.md',
            'chunk': sync.io.pack_chunk(b'abcdefg'),
            'location': 'shared'
        })
        self.assert_no_errors(posted.response)

        written_path = os.path.join(
            project.source_directory,
            '..',
            '__cauldron_shared_libs',
            'library',
            'test.md'
        )
        self.assertTrue(os.path.exists(written_path))

        support.run_remote_command('close')
コード例 #14
0
    def test_no_such_file(self):
        """ should return a 204 status when no such file exists """

        support.create_project(self, 'project-downloader-1')

        downloaded = self.get('/project-download/fake.filename.not_real')
        self.assertEqual(downloaded.flask.status_code, 204)
コード例 #15
0
ファイル: test_steps.py プロジェクト: sernst/cauldron
    def test_modify_move(self):
        """..."""
        support.create_project(self, 'harvey')
        support.add_step(self, contents='#S1')
        support.add_step(self, contents='#S2')

        r = support.run_command('steps list')
        step = r.data['steps'][-1]

        r = support.run_command(
            'steps modify {} --position=0'.format(step['name'])
        )
        self.assertFalse(r.failed, Message(
            'Failed to move step 2 to the beginning',
            response=r
        ))

        r = support.run_command('steps list')
        step = r.data['steps'][0]

        with open(step['source_path'], 'r') as f:
            contents = f.read()

        self.assertEqual(contents.strip(), '#S2', Message(
            'Step 2 should now be Step 1',
            response=r
        ))
コード例 #16
0
    def test_nameless_step(self):
        """ should rename properly a nameless step """

        support.create_project(self, 'columbia-heights')
        project = cauldron.project.get_internal_project()
        project.naming_scheme = None

        support.add_step(self)
        support.add_step(self)

        r = Response()
        with patch('cauldron.session.naming.explode_filename') as func:
            func.return_value = dict(
                extension='py',
                index=1,
                name=''
            )
            step_actions.modify_step(
                response=r,
                project=project,
                name=project.steps[0].filename,
                new_name='',
                position=2
            )

        self.assertFalse(r.failed)
コード例 #17
0
ファイル: test_runner_source.py プロジェクト: sernst/cauldron
    def test_run_no_step(self):
        """ should fail to run a None step """

        support.create_project(self, 'jefferson')
        project = cd.project.get_internal_project()
        result = source.run_step(Response(), project, 'FAKE.STEP')
        self.assertFalse(result)
コード例 #18
0
ファイル: test_steps.py プロジェクト: larsrinn/cauldron
    def test_autocomplete(self):
        """

        :return:
        """

        support.create_project(self, 'gina')
        support.add_step(self, 'a.py')
        support.add_step(self, 'b.py')

        result = support.autocomplete('steps a')
        self.assertIn('add', result)

        result = support.autocomplete('steps modify ')
        self.assertEqual(
            len(result), 2,
            'there are two steps in {}'.format(result)
        )

        result = support.autocomplete('steps modify a.py --')
        self.assertIn('name=', result)

        result = support.autocomplete('steps modify fake.py --position=')
        self.assertEqual(
            len(result), 2,
            'there are two steps in {}'.format(result)
        )

        support.run_command('close')
コード例 #19
0
    def test_exception(self):
        """
        """

        support.create_project(self, 'brad')
        support.add_step(
            self, 'brad_one.py', cli.reformat(
                """
                import cauldron as cd

                a = dict(
                    one=1,
                    two=['1', '2'],
                    three={'a': True, 'b': False, 'c': True}
                )

                cd.display.inspect(a)
                cd.shared.a = a
                cd.display.workspace()

                """
            )
        )
        support.add_step(self, 'brad_two.py', "1 + 's'")

        r = support.run_command('run .')
        self.assertFalse(r.failed, 'should not have failed')

        r = support.run_command('run .')
        self.assertTrue(r.failed, 'should have failed')
コード例 #20
0
ファイル: test_steps.py プロジェクト: larsrinn/cauldron
    def test_modify_move(self):
        """

        :return:
        """

        support.create_project(self, 'harvey')
        support.add_step(self, contents='#S1')
        support.add_step(self, contents='#S2')

        r = support.run_command('steps list')
        step = r.data['steps'][-1]

        r = support.run_command(
            'steps modify {} --position=0'.format(step['name'])
        )
        self.assertFalse(r.failed, Message(
            'Failed to move step 2 to the beginning',
            response=r
        ))

        r = support.run_command('steps list')
        step = r.data['steps'][0]

        with open(step['source_path'], 'r') as f:
            contents = f.read()

        self.assertEqual(contents.strip(), '#S2', Message(
            'Step 2 should now be Step 1',
            response=r
        ))

        support.run_command('close')
コード例 #21
0
    def test_jinja(self):
        """ should add jinja template to display """

        support.create_project(self, 'starbuck')

        project = cauldron.project.get_internal_project()

        jinja_path = os.path.join(
            project.source_directory,
            'template.html'
        )

        with open(jinja_path, 'w') as fp:
            fp.write('<div>Hello {{ name }}</div>')

        step_contents = '\n'.join([
            'import cauldron as cd',
            'cd.display.jinja("{}", name="starbuck")'.format(
                jinja_path.replace('\\', '\\\\')
            )
        ])

        support.add_step(self, contents=step_contents)

        r = support.run_command('run')
        self.assertFalse(r.failed, 'should not have failed')
コード例 #22
0
ファイル: test_exposed.py プロジェクト: sernst/cauldron
    def test_stop_step_no_halt(self):
        """
        Should stop the step early but continue running future steps
        """
        support.create_project(self, 'homer2')
        support.add_step(self, contents='\n'.join([
            'import cauldron as cd',
            'cd.shared.test = 0',
            'cd.shared.other = 0',
            'cd.step.breathe()',
            'cd.shared.test = 1',
            'cd.step.stop()',
            'cd.shared.test = 2'
        ]))
        support.add_step(self, contents='\n'.join([
            'import cauldron as cd',
            'cd.shared.other = 1'
        ]))

        support.run_command('run')
        project = cd.project.get_internal_project()
        step = project.steps[0]

        self.assertEqual(project.shared.fetch('test'), 1)
        self.assertEqual(project.shared.fetch('other'), 1)
        self.assertNotEqual(-1, step.dom.find('cd-StepStop'))
コード例 #23
0
ファイル: test_exposed.py プロジェクト: DanMayhew/cauldron
    def test_change_title(self):
        """Title should change through exposed project"""

        test_title = 'Some Title'

        support.create_project(self, 'igor')
        cd.project.title = test_title
        self.assertEqual(cd.project.title, test_title)
コード例 #24
0
    def test_get_missing_step(self):
        """ should get None for a fictional step name """

        support.create_project(self, 'george')
        support.add_step(self)

        project = cd.project.get_internal_project()
        self.assertIsNone(source.get_step(project, 'FICTIONAL-STEP'))
コード例 #25
0
ファイル: test_step_actions.py プロジェクト: sernst/cauldron
    def test_index_from_location_bad_string(self):
        """ should return default value if bad string is supplied """

        support.create_project(self, 'ray')
        project = cauldron.project.get_internal_project()

        result = step_actions.index_from_location(None, project, '12s', 42)
        self.assertEqual(result, 42)
コード例 #26
0
ファイル: test_runner_source.py プロジェクト: sernst/cauldron
    def test_get_missing_step(self):
        """ should get None for a fictional step name """

        support.create_project(self, 'george')
        support.add_step(self)

        project = cd.project.get_internal_project()
        self.assertIsNone(source.get_step(project, 'FICTIONAL-STEP'))
コード例 #27
0
 def test_elapsed(self):
     """Should render elapsed time"""
     support.create_project(self, 'test_elapsed')
     step_contents = '\n'.join(
         ['import cauldron as cd', 'cd.display.elapsed()'])
     support.add_step(self, contents=step_contents)
     r = support.run_command('run')
     self.assertFalse(r.failed, 'should not have failed')
コード例 #28
0
    def test_index_from_location_bad_string(self):
        """ should return default value if bad string is supplied """

        support.create_project(self, 'ray')
        project = cauldron.project.get_internal_project()

        result = step_actions.index_from_location(None, project, '12s', 42)
        self.assertEqual(result, 42)
コード例 #29
0
    def test_no_args(self):
        """ should fail if no path argument """

        support.create_project(self, 'mercury')

        r = export.execute(context=cli.make_command_context(export.NAME),
                           path='')
        self.assertTrue(r.failed)
        self.assertEqual(r.errors[0].code, 'MISSING_PATH_ARG')
コード例 #30
0
ファイル: test_status.py プロジェクト: sernst/cauldron
    def test_of_project(self):
        """ should return information about the project """

        support.create_project(self, 'eric')
        project = cauldron.project.get_internal_project()
        results = status.of_project(project)

        self.assertEqual(len(results['libraries']), 3)
        self.assertEqual(len(results['project'].keys()), 1)
コード例 #31
0
    def test_file_source_path(self):
        """A file source directory should be a directory"""

        support.create_project(self, 'lupin')
        project = cd.project.internal_project

        p = projects.Project(project.source_path)
        self.assertTrue(os.path.isdir(p.source_directory))
        self.assertEqual(p.source_directory, project.source_directory)
コード例 #32
0
    def test_title(self):
        """Project title should be readable and writable"""

        support.create_project(self, 'sirius')
        project = cd.project.internal_project

        title = 'My Title'
        project.title = title
        self.assertEqual(title, project.title)
コード例 #33
0
    def test_of_project(self):
        """ should return information about the project """

        support.create_project(self, 'eric')
        project = cauldron.project.internal_project
        results = status.of_project(project)

        self.assertEqual(len(results['libraries']), 2)
        self.assertEqual(len(results['project'].keys()), 1)
コード例 #34
0
    def test_invalid_markdown(self):
        """ should fail with a jinja error """

        support.create_project(self, 'des-moines')
        support.add_step(self,
                         'test.md',
                         contents='# Hello {{ missing_variable + "12" }}')
        response = support.run_command('run -f')
        self.assertTrue(response.failed)
コード例 #35
0
    def test_run_skip_status(self, *args):
        """ should succeed without running a with a skip status """

        support.create_project(self, 'adams')
        support.add_step(self)
        project = cd.project.get_internal_project()
        step = project.steps[0]

        result = source.run_step(Response(), project, step)
        self.assertTrue(result)
コード例 #36
0
    def test_save_file_no_extension_success(self):
        """ should write a cauldron file """

        support.create_project(self, 'tyrannosaurus')
        path = self.get_temp_path('save-success-2', 'project')
        r = support.run_command('save "{}"'.format(path))
        self.assertFalse(r.failed)
        self.assertTrue(os.path.exists(r.data['path']))
        self.trace('PATH:', r.data['path'])
        self.assertTrue(r.data['path'].endswith('project.cauldron'))
コード例 #37
0
    def test_fails_write(self, write_func):
        """ should fail when the write function raises an exception """
        write_func.side_effect = IOError('Write failed')

        support.create_project(self, 'rex')
        path = self.get_temp_path('save-fail-2')
        r = support.run_command('save "{}"'.format(path))
        self.assertTrue(r.failed)
        self.assertGreater(len(r.errors), 0)
        self.assertEqual(r.errors[0].code, 'WRITE_SAVE_ERROR')
コード例 #38
0
    def test_index_from_location_step_name(self):
        """ should return index from step name if supplied """

        support.create_project(self, 'bradbury')
        support.add_step(self)
        project = cauldron.project.get_internal_project()
        step = project.steps[0]

        result = step_actions.index_from_location(None, project, step.filename)
        self.assertEqual(result, 1)
コード例 #39
0
    def test_valid(self):
        """ should refresh the project """

        support.create_project(self, 'hammer')

        touched = self.get('/sync-touch')
        self.assertEqual(touched.flask.status_code, 200)

        response = touched.response
        self.assertEqual(len(response.errors), 0)
コード例 #40
0
 def test_image(self):
     """Should render an assets image to the dom."""
     support.create_project(self, 'test_image')
     step_contents = '\n'.join([
         'import cauldron as cd',
         'cd.display.image("foo.jpg", 12, 13, "center")'
     ])
     support.add_step(self, contents=step_contents)
     r = support.run_command('run')
     self.assertTrue(r.success, 'should not have failed')
コード例 #41
0
    def test_steps_add(self):
        """Should add a step"""
        support.create_project(self, 'bob')
        project = cauldron.project.get_internal_project()

        r = support.run_command('steps add first.py')
        self.assertFalse(r.failed, 'should not have failed')
        self.assertTrue(
            os.path.exists(
                os.path.join(project.source_directory, 'S01-first.py')))
コード例 #42
0
ファイル: test_steps.py プロジェクト: sernst/cauldron
    def test_steps_add(self):
        """Should add a step"""
        support.create_project(self, 'bob')
        project = cauldron.project.get_internal_project()

        r = support.run_command('steps add first.py')
        self.assertFalse(r.failed, 'should not have failed')
        self.assertTrue(os.path.exists(
            os.path.join(project.source_directory, 'S01-first.py')
        ))
コード例 #43
0
    def test_has_error(self):
        """Should have error if step raises an error when run"""

        support.create_project(self, 'petunia')
        project = cd.project.internal_project

        support.add_step(self, contents='raise Exception("test")')
        support.run_command('run')

        self.assertTrue(project.has_error, 'step should have errored')
コード例 #44
0
ファイル: test_runner_source.py プロジェクト: sernst/cauldron
    def test_run_skip_status(self, *args):
        """ should succeed without running a with a skip status """

        support.create_project(self, 'adams')
        support.add_step(self)
        project = cd.project.get_internal_project()
        step = project.steps[0]

        result = source.run_step(Response(), project, step)
        self.assertTrue(result)
コード例 #45
0
ファイル: test_runner_source.py プロジェクト: sernst/cauldron
    def test_run_error_status(self, *args):
        """ should fail to run a with an error status """

        support.create_project(self, 'john')
        support.add_step(self)
        project = cd.project.get_internal_project()
        step = project.steps[0]

        result = source.run_step(Response(), project, step)
        self.assertFalse(result)
コード例 #46
0
ファイル: test_sync_touch.py プロジェクト: sernst/cauldron
    def test_valid(self):
        """ should refresh the project """

        support.create_project(self, 'hammer')

        touched = self.get('/sync-touch')
        self.assertEqual(touched.flask.status_code, 200)

        response = touched.response
        self.assertEqual(len(response.errors), 0)
コード例 #47
0
    def test_run_markdown(self):
        """ should render markdown """

        support.create_project(self, 'salem')
        support.add_step(self, 'test.md', contents='This is markdown')
        response = support.run_command('run -f')
        self.assertFalse(response.failed, 'should have failed')

        step = cd.project.get_internal_project().steps[0]
        self.assertFalse(step.is_dirty())
コード例 #48
0
ファイル: test_refresh.py プロジェクト: selasley/cauldron
    def test_update_not_modified(self):
        """ should abort refresh if updated file is identical to previous """

        support.create_project(self, 'dracon')

        project_data = self.read_project_file()
        self.write_project_file(project_data)

        project = cd.project.get_internal_project()
        self.assertFalse(project.refresh(), 'should not have refreshed')
コード例 #49
0
ファイル: test_step_actions.py プロジェクト: sernst/cauldron
    def test_index_from_location_step_name(self):
        """ should return index from step name if supplied """

        support.create_project(self, 'bradbury')
        support.add_step(self)
        project = cauldron.project.get_internal_project()
        step = project.steps[0]

        result = step_actions.index_from_location(None, project, step.filename)
        self.assertEqual(result, 1)
コード例 #50
0
ファイル: test_refresh.py プロジェクト: sernst/cauldron
    def test_update_not_modified(self):
        """ should abort refresh if updated file is identical to previous """

        support.create_project(self, 'dracon')

        project_data = self.read_project_file()
        self.write_project_file(project_data)

        project = cd.project.get_internal_project()
        self.assertFalse(project.refresh(), 'should not have refreshed')
コード例 #51
0
ファイル: test_save.py プロジェクト: sernst/cauldron
    def test_fails_write(self, write_func):
        """ should fail when the write function raises an exception """
        write_func.side_effect = IOError('Write failed')

        support.create_project(self, 'rex')
        path = self.get_temp_path('save-fail-2')
        r = support.run_command('save "{}"'.format(path))
        self.assertTrue(r.failed)
        self.assertGreater(len(r.errors), 0)
        self.assertEqual(r.errors[0].code, 'WRITE_SAVE_ERROR')
コード例 #52
0
ファイル: test_save.py プロジェクト: sernst/cauldron
    def test_save_file_no_extension_success(self):
        """ should write a cauldron file """

        support.create_project(self, 'tyrannosaurus')
        path = self.get_temp_path('save-success-2', 'project')
        r = support.run_command('save "{}"'.format(path))
        self.assertFalse(r.failed)
        self.assertTrue(os.path.exists(r.data['path']))
        self.trace('PATH:', r.data['path'])
        self.assertTrue(r.data['path'].endswith('project.cauldron'))
コード例 #53
0
    def test_run_markdown(self):
        """ should render markdown """

        support.create_project(self, 'salem')
        support.add_step(self, 'test.md', contents='This is markdown')
        response = support.run_command('run -f')
        self.assertFalse(response.failed, 'should have failed')

        step = cd.project.internal_project.steps[0]
        self.assertFalse(step.is_dirty())
コード例 #54
0
 def test_elapsed(self):
     """Should render elapsed time"""
     support.create_project(self, 'test_elapsed')
     step_contents = '\n'.join([
         'import cauldron as cd',
         'cd.display.elapsed()'
     ])
     support.add_step(self, contents=step_contents)
     r = support.run_command('run')
     self.assertFalse(r.failed, 'should not have failed')
コード例 #55
0
ファイル: test_export.py プロジェクト: sernst/cauldron
    def test_no_args(self):
        """ should fail if no path argument """

        support.create_project(self, 'mercury')

        r = export.execute(
            context=cli.make_command_context(export.NAME),
            path=''
        )
        self.assertTrue(r.failed)
        self.assertEqual(r.errors[0].code, 'MISSING_PATH_ARG')
コード例 #56
0
ファイル: test_server_status.py プロジェクト: sernst/cauldron
    def test_clean_step_no_step(self):
        """ should fail when no such step exists """

        support.create_project(self, 'luigi')

        cleaned = self.get('/clean-step/fake')
        self.assertEqual(cleaned.flask.status_code, 200)

        response = cleaned.response
        self.assertFalse(response.success)
        self.assert_has_error_code(response, 'STEP_FETCH_ERROR')
コード例 #57
0
ファイル: test_steps.py プロジェクト: sernst/cauldron
    def test_steps_muting(self):
        """Should mute a step"""
        support.create_project(self, 'larry')

        support.run_command('steps add first.py')

        r = support.run_command('steps mute S01-first.py')
        self.assertFalse(r.failed, 'should not have failed')

        r = support.run_command('steps unmute S01-first.py')
        self.assertFalse(r.failed, 'should nto have failed')
コード例 #58
0
    def test_invalid_markdown(self):
        """ should fail with a jinja error """

        support.create_project(self, 'des-moines')
        support.add_step(
            self,
            'test.md',
            contents='# Hello {{ missing_variable + "12" }}'
        )
        response = support.run_command('run -f')
        self.assertTrue(response.failed)