From 0ad816bc99bcbd85cabe52bcc6c36b0394e5ff0e Mon Sep 17 00:00:00 2001 From: Michael Joseph Date: Thu, 2 Oct 2014 13:45:51 +0200 Subject: [PATCH] Refactor and limit verification --- tests/__init__.py | 1 + tests/test_remarkable.py | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 61ae0b5..168ca43 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -41,6 +41,7 @@ class BaseTestCase(TestCase): title = 'Application To Platform' directory_name = 'application-to-platform' example_file = 'atp.md' + presentation_index = '%s/index.html' % directory_name def setUp(self): with open(self.example_file, 'w') as f: diff --git a/tests/test_remarkable.py b/tests/test_remarkable.py index 3d2cae3..173986c 100644 --- a/tests/test_remarkable.py +++ b/tests/test_remarkable.py @@ -14,7 +14,6 @@ class TestRemarkTestCase(BaseTestCase): def test_remark(self): - presentation_index = '%s/index.html' % self.directory_name sys.argv = [ 'remarkable', 'remark', @@ -22,17 +21,15 @@ def test_remark(self): self.title, ] cli.main() - self.assertTrue(os.path.exists(presentation_index)) - presentation_contents = io.open(presentation_index).read() + self.assertTrue(os.path.exists(self.presentation_index)) + presentation_contents = io.open(self.presentation_index).read() self.assertTrue(self.title in presentation_contents) - self.assertTrue('michaeljoseph' in presentation_contents) - shutil.rmtree('application-to-platform') + shutil.rmtree(self.directory_name) class TestRevealTestCase(BaseTestCase): def test_reveal(self): - presentation_index = 'application-to-platform/index.html' sys.argv = [ 'remarkable', 'reveal', @@ -40,6 +37,7 @@ def test_reveal(self): self.title, ] cli.main() - self.assertTrue(os.path.exists(presentation_index)) - self.assertTrue(self.title in io.open(presentation_index).read()) - shutil.rmtree('application-to-platform') + self.assertTrue(os.path.exists(self.presentation_index)) + presentation_contents = io.open(self.presentation_index).read() + self.assertTrue(self.title in presentation_contents) + shutil.rmtree(self.directory_name)