Exemplo n.º 1
0
    def test_write_file_with_controller(self):
        View.process = lambda _: 0

        with fake_project():
            self.config.parseOptions(['view', 'test_view', 'dummy'])
            view = View(self.config)
            view._write_view()
            view_file = filepath.FilePath(
                'application/view/Dummy/test_view.html')

            self.assertTrue(view_file.exists())
            view_file.remove()
Exemplo n.º 2
0
    def test_write_file_with_controller(self):
        View.process = lambda _: 0

        with fake_project():
            self.config.parseOptions(['view', 'test_view', 'dummy'])
            view = View(self.config)
            view._write_view()
            view_file = filepath.FilePath(
                'application/view/Dummy/test_view.html'
            )

            self.assertTrue(view_file.exists())
            view_file.remove()
Exemplo n.º 3
0
    def test_write_file_with_controller(self):
        View.process = lambda _: 0

        currdir = os.getcwd()
        os.chdir('../mamba/test/dummy_app/')

        self.config.parseOptions(['view', 'test_view', 'dummy'])
        view = View(self.config)
        view._write_view()
        view_file = filepath.FilePath('application/view/Dummy/test_view.html')

        self.assertTrue(view_file.exists())
        view_file.remove()

        os.chdir(currdir)
Exemplo n.º 4
0
    def test_dump(self):
        View.process = lambda _: 0

        self.config.parseOptions(['view', '--dump', 'test_model'])
        view = View(self.config)
        view._dump_view()
        self.assertTrue(
            '    <!--\n'
            '        Copyright (c) {year} - {author} <{author}@localhost>\n\n'
            '        view: TestModel\n'
            '            synopsis: None\n\n'
            '        viewauthor: {author} <{author}@localhost>\n'
            '    -->\n\n'
            '    <h2>It works!</h2>\n\n'.format(
                author=getpass.getuser(), year=datetime.datetime.now().year) in
            self.capture.getvalue())
Exemplo n.º 5
0
    def test_write_file_with_controller(self):
        View.process = lambda _: 0

        currdir = os.getcwd()
        os.chdir('../mamba/test/dummy_app/')

        self.config.parseOptions(['view', 'test_view', 'dummy'])
        view = View(self.config)
        view._write_view()
        view_file = filepath.FilePath(
            'application/view/Dummy/test_view.html'
        )

        self.assertTrue(view_file.exists())
        view_file.remove()

        os.chdir(currdir)
Exemplo n.º 6
0
    def test_dump(self):
        View.process = lambda _: 0

        self.config.parseOptions(['view', '--dump', 'test_model'])
        view = View(self.config)
        view._dump_view()
        self.assertTrue(
            '    <!--\n'
            '        Copyright (c) {year} - {author} <{author}@localhost>\n\n'
            '        view: TestModel\n'
            '            synopsis: None\n\n'
            '        viewauthor: {author} <{author}@localhost>\n'
            '    -->\n\n'
            '    <h2>It works!</h2>\n\n'.format(
                author=getpass.getuser(), year=datetime.datetime.now().year
            ) in self.capture.getvalue()
        )