<div dir="ltr"><div><div><div>Heya,<br><br>Okay, fixed the issues we talked about in IRC and that. It no longer uses the<br>testdata.py file, and the test data is loaded in the test itself.<br><br>I used git format-patch but not git send email, because <a href="http://mail.dcu.ie">mail.dcu.ie</a> is handled<br>by Gmail and I can't setup SMTP at the moment because of login redirects. I<br>don't know how the line cap slipped in anyway.<br><br></div>I think this patch should work anyway. If something is wrong, i've attached the<br></div>file git generated anyway. If something is wrong with _that_: well I'll need to do<br></div>some more digging.<br><div><div><div><br>Cheers,<br>Aaron Delaney<br><br>---<br> debsources/tests/test_webapp.py | 20 ++++++++++++++++++++<br> 1 file changed, 20 insertions(+)<br><br>diff --git a/debsources/tests/test_webapp.py b/debsources/tests/test_webapp.py<br>index ccbf1b4..a022465 100644<br>--- a/debsources/tests/test_webapp.py<br>+++ b/debsources/tests/test_webapp.py<br>@@ -53,6 +53,21 @@ class DebsourcesBaseWebTests(DbTestFixture):<br>         cls.app_wrapper.engine.dispose()<br>         cls.db_teardown_cls()<br> <br>+    def create_news_file(self, name):<br>+        """Returns news file contents"""<br>+        fullpath = os.path.join(self.app_wrapper.app.config["LOCAL_DIR"], name)<br>+        # don't overwrite any news files that already exist<br>+        if os.path.isfile(fullpath):<br>+            news_string = ""<br>+            with open(fullpath, 'r') as f:<br>+                news_string = f.read()<br>+            return news_string<br>+        else:<br>+            news_string = "<ul><li>This item was created in a test</li></ul>"<br>+            with open(fullpath, 'w') as f:<br>+                f.write(news_string)<br>+            return news_string<br>+<br> <br> @attr('webapp')<br> class DebsourcesTestCase(DebsourcesBaseWebTests, unittest.TestCase):<br>@@ -556,6 +571,11 @@ class DebsourcesTestCase(DebsourcesBaseWebTests, unittest.TestCase):<br>             rv = self.app.get('/copyright/')<br>             self.assertEqual(200, rv.status_code)<br> <br>+    def test_index_help(self):<br>+        # create_news_file preserves existing news files<br>+        source_news_data = self.create_news_file('sources_news.html')<br>+        rv = self.app.get('/')<br>+        self.assertIn(source_news_data, rv.data)<br> <br> if __name__ == '__main__':<br>     unittest.main(exit=False)<br>-- <br>2.1.4<br><br><br></div></div></div></div>