Browsed by
Tag: development

Mocking SQLAlchemy models in Python

Mocking SQLAlchemy models in Python

I’m developing an API using Python’s Flask framework. The API uses SQLAlchemy, which means that database rows are made available as regular Python classes (referred to as database models) in my Python code. One of my models looks something like this:

My Data Access Object (DAO) for communicating with the database models looks like this:

While writing tests for the API, I wanted to mock out the database models, so that my tests wouldn’t depend on an actual…

Read More Read More

Setting up Sublime Text as a node.js development environment

Setting up Sublime Text as a node.js development environment

Sublime Text makes a great IDE for node.js development. First, install the node.js software and get your initial project up and running. Various tutorials on the web should get you going. When it’s time to run your app, configure the Sublime Text build system to build it and run it. To avoid having to start and stop your Node server manually, make use of the tool Nodemon – this tool will build and run your app automatically when you edit…

Read More Read More