Beispiel #1
0
    def test_init_should_create_dot_booknote_directory(self):
        # Assign
        with clone_fixture('empty_directory') as directory:
            booknot_storage = LocalBooknotStorage(directory)

            # Acts
            booknot_storage.init_store()

            self.assertTrue(os.path.isdir(os.path.join(directory, '.booknot')))
Beispiel #2
0
    def test_is_sphinx_present_should_return_false_when_sphinx_is_not_present(self):
        # Assign
        with clone_fixture('empty_directory') as directory:
            working_dir = os.path.join(directory)
            booknot_storage = LocalBooknotStorage(working_dir)

            # Acts
            is_present = booknot_storage.is_sphinx_present()

            self.assertFalse(is_present)
Beispiel #3
0
    def test_is_sphinx_present_should_check_conf_py_is_present_in_parent(self):
        # Assign
        with clone_fixture('sphinx') as directory:
            working_dir = os.path.join(directory, 'reading_notes')
            booknot_storage = LocalBooknotStorage(working_dir)

            # Acts
            is_present = booknot_storage.is_sphinx_present()

            self.assertTrue(is_present)
Beispiel #4
0
    def test_run_should_create_the_index_of_the_note(self):
        with clone_fixture('empty_booknot') as directory:
            # Assign
            self._tested.directory = directory
            self.crawler_mock.fetch = Mock(
                return_value=Metadata(url="",
                                      title="my title",
                                      description="",
                                      capture_date=datetime(2020, 1, 1)))

            # Acts
            result = self._tested.run()

            # Assert
            note_index = os.path.join(directory, '20200101__my_title',
                                      'index.rst')

            self.assertTrue(os.path.isfile(note_index),
                            f'note manifest does not exists in {note_index}')