Test now works again (e.g. change DATABASE_URI to SQLALCHEMY_DATABASE_URI).
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Thu, 9 May 2019 19:04:32 +0000 (19:04 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Thu, 9 May 2019 19:04:32 +0000 (19:04 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrfeed/trunk@2804 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_wrfeed.py
wrfeed/test.cfg

index 64978095d482244d43badd8e65d700ee8cc7de27..aed5896cb19ce8661e8ed52385f1fcec312b75d2 100644 (file)
@@ -1,5 +1,9 @@
 """How to test wrfeed:
 
+To prepare a system for testing, create a database philipp_winterrodeln_wiki_wrfeed_test with mysql:
+echo 'create database philipp_winterrodeln_wiki_wrfeed_test;' | mysql
+mysql philipp_winterrodeln_wiki_wrfeed_test < testdb.sql
+
 WRFEED_SETTINGS=../wrfeed/test.cfg python3 -m unittest tests/test_wrfeed.py
 """
 import unittest
@@ -27,7 +31,7 @@ class TestDbWrfeed(WrfeedTestBase):
         super().setUp()
         with wrfeed.app.app_context():
             # create database
-            uri = make_url(wrfeed.app.config['DATABASE_URI'])
+            uri = make_url(wrfeed.app.config['SQLALCHEMY_DATABASE_URI'])
             self.uri = uri
             uri_nodb = URL(uri.drivername, host=uri.host, port=uri.port, username=uri.username, password=uri.password, query=uri.query)
             engine_nodb = sqlalchemy.create_engine(uri_nodb)
@@ -53,11 +57,6 @@ class TestDbWrfeed(WrfeedTestBase):
             con.execute("UPDATE wrreport SET date_invalid = date_invalid + INTERVAL %s SECOND", (seconds_diff,))
             con.execute("UPDATE wrreport SET delete_date = delete_date + INTERVAL %s SECOND", (seconds_diff,))
 
-
-    def tearDown(self):
-        with wrfeed.app.app_context():
-            self.engine.execute("DROP DATABASE {}".format(self.uri.database))
-
     def test_alle(self):
         result = self.app.get('/berichte/alle')
         self.assertTrue(result.data.startswith(b'<?xml'))
index 3993e6d1a358e641d6e7abc99b7c7c8b514e6de2..e8f346601ff5dbe088a471350477f3ce881f4429 100644 (file)
@@ -1,5 +1,5 @@
 DEBUG = False
 SECRET_KEY = b'\x00Y:\xfc\xc4^Q;\x1f\x1d\xe8\xd1\xc4L\x04*\xdd;4\xb5\x00\x91\xe6\xf9'
-DATABASE_URI = 'mysql://philipp@localhost:3306/philipp_winterrodeln_wiki_wrfeed_test?charset=utf8&use_unicode=1'
+SQLALCHEMY_DATABASE_URI = 'mysql://philipp@localhost:3306/philipp_winterrodeln_wiki_wrfeed_test?charset=utf8&use_unicode=1'
 FEEDENTRYLIMIT = 150
 SQLALCHEMY_TRACK_MODIFICATIONS = False