示例#1
0
class TestLocalRepo(unittest.TestCase):
    def setUp(self):
        library_path = "./test/library"
        self.book = Book(13529, library_path=library_path)
        # TODO: Mock fetch_remote_book_to_local_path to
        #       copy test_data/sea_ppwer to 13529

        def copy_test_book():
            # FIXME: use filesystem for this, cp fails silently?
            sh.cp("./gitenberg/tests/test_data/13529", library_path)

        self.book.fetch_remote_book_to_local_path = copy_test_book
        self.book.fetch()

    def test_init(self):
        l_r = LocalRepo(self.book)
        self.assertEqual(l_r.book, self.book)

    def test_init_repo(self):
        l_r = LocalRepo(self.book)
        l_r.add_all_files()
        self.assertTrue(os.path.exists("./test/library/13529/.git"))

    def tearDown(self):
        self.book.remove()
示例#2
0
文件: test.py 项目: laegrim/gitberg
class TestLocalRepo(unittest.TestCase):

    def setUp(self):
        library_path = './test/library'
        self.book = Book(13529, library_path=library_path)
        # TODO: Mock fetch_remote_book_to_local_path to
        #       copy test_data/sea_ppwer to 13529

        def copy_test_book():
            sh.cp('./gitenberg/test_data/13529', library_path)

        self.book.fetch_remote_book_to_local_path = copy_test_book
        self.book.fetch()

    def test_init(self):
        l_r = LocalRepo(self.book)
        self.assertEqual(
            l_r.book,
            self.book
        )

    def test_init_repo(self):
        l_r = LocalRepo(self.book)
        l_r.add_all_files()
        self.assertTrue(
            os.path.exists('./test/library/13529/.git')
        )

    def tearDown(self):
        self.book.remove()
示例#3
0
class TestLocalRepo(unittest.TestCase):

    def setUp(self):
        self.book = Book(13529)
        # TODO: Mock fetch_remote_book_to_local_path to
        #       copy test_data/sea_ppwer to 13529

        def copy_test_book():
            # FIXME: use filesystem for this, cp fails silently?
            sh.cp('./gitenberg/tests/test_data/1234', library_path)

        self.book.fetch_remote_book_to_local_path = copy_test_book
        self.book.fetch()

    def test_init(self):
        l_r = LocalRepo(self.book)
        self.assertEqual(
            l_r.book,
            self.book
        )

    def test_init_repo(self):
        l_r = LocalRepo(self.book)
        l_r.add_all_files()
        self.assertTrue(
            os.path.exists(config.data['library_path']+'/13529/.git')
        )

    def tearDown(self):
        self.book.remove()
示例#4
0
class TestNewFileHandler():

    def setUp(self):
        self.book = Book(333, library_path='./test/library')
        self.book.fetch()
        self.file_handler = NewFilesHandler(self.book)

    def test_readme(self):
        self.file_handler.template_readme()
        self.assertTrue(
            os.path.exists('./test/library/333/README.rst')
        )

    def tearDown(self):
        self.book.remove()
示例#5
0
文件: test.py 项目: laegrim/gitberg
class TestNewFileHandler():

    def setUp(self):
        self.book = Book(333, library_path='./test/library')
        self.book.fetch_remote_book_to_local_path = null
        self.book.fetch()
        self.file_handler = NewFilesHandler(self.book)

    def test_readme(self):
        self.file_handler.template_readme()
        self.assertTrue(
            os.path.exists('./test/library/333/README.rst')
        )

    def tearDown(self):
        self.book.remove()
示例#6
0
class TestLocalRepo(unittest.TestCase):

    def setUp(self):
        self.book = Book(333, library_path='./test/library')
        self.book.fetch()

    def test_init(self):
        l_r = LocalRepo(self.book)
        self.assertEqual(
            l_r.book,
            self.book
        )

    def test_init_repo(self):
        l_r = LocalRepo(self.book)
        l_r.add_all_files()
        self.assertTrue(
            os.path.exists('./test/library/333/.git')
        )

    def tearDown(self):
        self.book.remove()