Example #1
0
    def test_draft_found(self):
        with tmp_folder() as tmp_dir:
            create_project_structure(tmp_dir, 'one_post_drafted')

            cmd = Commands({})
            with capture() as output:
                cmd.drafts()

            regex = re.compile(r".*A draft example.*", re.DOTALL)
            self.assertTrue(regex.match(output[0]))
Example #2
0
    def test_author_detailed_found(self):
        with tmp_folder() as tmp_dir:
            create_project_structure(tmp_dir, 'one_post')

            cmd = Commands({'<name>': 'john'})
            with capture() as output:
                cmd.authors()

            regex = re.compile(r".*A post example.*", re.DOTALL)
            self.assertTrue(regex.match(output[0]))
Example #3
0
    def test_category_found(self):
        with tmp_folder() as tmp_dir:
            create_project_structure(tmp_dir, 'one_post')

            cmd = Commands({'<name>': None})
            with capture() as output:
                cmd.categories()

            regex = re.compile(r".*ExampleCat.*", re.DOTALL)
            self.assertTrue(regex.match(output[0]))
Example #4
0
    def test_no_drafts_founds(self, l):
        with tmp_folder() as tmp_dir:
            create_project_structure(tmp_dir, 'empty_project')

            cmd = Commands({})
            cmd.drafts()

            self.assertEqual(
                "No drafts found.",
                l.records[0].getMessage()
            )
Example #5
0
    def test_author_not_found(self, l):
        with tmp_folder() as tmp_dir:
            create_project_structure(tmp_dir, 'one_post')

            cmd = Commands({'<name>': 'Foo'})
            cmd.authors()

            self.assertEqual(
                "Author 'Foo' not found.",
                l.records[0].getMessage()
            )