APIARY_PROFILES_URL = STUDENT_APIARY_PROJECT + "/#reference/profiles/" APIARY_RELS_URL = STUDENT_APIARY_PROJECT + "/#reference/link-relations/" USER_SCHEMA_URL = "/updown/schema/user/" CURRENCY_SCHEMA_URL = "/updown/schema/user/" CHOICE_SCHEMA_URL = "/updown/schema/user/" EXCHANGE_SCHEMA_URL = "/updown/schema/user/" LINK_RELATIONS_URL = "/updown/link-relations/" #Define the application and the api app = Flask(__name__, static_folder="static", static_url_path="/.") app.debug = True # Set the database Engine. In order to modify the database file (e.g. for # testing) provide the database path app.config to modify the #database to be used (for instance for testing) app.config.update({"Engine": database.Engine()}) #Start the RESTful API. api = Api(app) # These two classes below are how we make producing the resource representation # JSON documents manageable and resilient to errors. As noted, our mediatype is # Mason. Similar solutions can easily be implemented for other mediatypes. class MasonObject(dict): """ A convenience class for managing dictionaries that represent Mason objects. It provides nice shorthands for inserting some of the more elements into the object but mostly is just a parent for the much more useful subclass defined next. This class is generic in the sense that it does not contain any application specific implementation details.
''' Created on 13.02.2014 Modified on 25.02.2018 Database interface testing for all users related methods. @author: ivan ''' import sqlite3, unittest from updown import database #Path to the database file, different from the deployment db DB_PATH = 'db/updown_test.db' ENGINE = database.Engine(DB_PATH) #CONSTANTS DEFINING DIFFERENT USERS AND USERS PROPERTIES CREATE_USER_NAME = 'Dandou' CREATE_USER_FULL_NAME = 'Dandou full name' CREATE_USER_PASSWORD = '******' MODIFY_USER_NAME = 'nadiro' MODIFY_USER_FULL_NAME = 'Dandou full name' MODIFY_USER_PASSWORD = '******' NON_EXISTIN_USERNAME = '******' NON_EXISTIN_FULLNAME = 'fake fullname' NON_EXISTIN_PASSWORD = '******' DELETE_USERNAME = '******' DELETE_USERNAME_FAKE = 'nadirzzzzz' USER_CHOICE_USERNAME = '******'