From 35e0f4466677602e9ec6db614e8ea881dbf656cb Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Fri, 20 Apr 2018 22:12:03 +0200 Subject: [#1eeu1] Hiphopify (#54) * Changed the dev-mode logic to be the same as prod for creating new tables if they don't exist. Also added a new feature where a table can be initialized with data if you create a JSON file in the pysite/database/table_init/ folder and fill it with a list of dicts where each dict represents a row in your table. Included a hiphoppers json so that I can actually test if it works in production. It will only init the table if the table is empty. * Not sure if this will solve it, but I think so. * Renamed the tables and primary keys, and alphabetized the dict. Now complies with the gdudes holy wishes. * Almost done with the initial build for this. Implemented GET and DELETE, in order to finish POST I need to expand the database.py interface class. * Alphabetized database convenience wrappers. * Fixed a few typehints and added the sample convenience wrapper to the database class. * Finishing up the POST method and adding a duration parser to the utils folder so we can handle strings like 2w3d and turn them into a timestamp. * Fixed API blueprint loading, which was broken by the setup method in the DBMixIn. I'd forgotten to remove the check for table_name attribute. Also adde some logging and got the DELETE route working. * Added timezone-sensitivity to the duration parser so it will work with rethink. renamed the json and fixed some bugs in the hiphopify API. * Added a utility to test if rdb timestamps are expired, and only returning data from the GET calls if it isn't expired. * changed some log wording * Setting up Lil Joseph as default image. Adding some rappers to the list. * Adding a bunch of logging * These tests no longer apply. New tests must be written in the long run, removing them for now. * Addressing review comments left by Volcyy * Fixed misleading comment. --- app_test.py | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'app_test.py') diff --git a/app_test.py b/app_test.py index 20293db9..b9a71292 100644 --- a/app_test.py +++ b/app_test.py @@ -292,28 +292,6 @@ class Utilities(SiteTest): class MixinTests(SiteTest): """ Test cases for mixins """ - def test_dbmixin_runtime_error(self): - """ Check that wrong values for error view setup raises runtime error """ - from pysite.mixins import DBMixin - - dbm = DBMixin() - try: - dbm.setup('sdf', 'sdfsdf') - except RuntimeError: - return True - raise Exception('Expected runtime error on setup() when giving wrongful arguments') - - def test_dbmixin_table_property(self): - """ Check the table property returns correctly """ - from pysite.mixins import DBMixin - - try: - dbm = DBMixin() - dbm.table_name = 'Table' - self.assertEqual(dbm.table, 'Table') - except AttributeError: - pass - def test_handler_5xx(self): """ Check error view returns error message """ from werkzeug.exceptions import InternalServerError -- cgit v1.2.3