Sustainable Computing Research Group (SCoRe)
[Bassa] REST API endpoint testing
Let's create API endpoint testing for Bassa.
Use http://flask.pocoo.org/docs/0.12/testing/ to write tests for APIs.
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()
flaskr.app.testing = True
self.app = flaskr.app.test_client()
with flaskr.app.app_context():
flaskr.init_db()
def tearDown(self):
os.close(self.db_fd)
os.unlink(flaskr.app.config['DATABASE'])
def test_empty_db(self):
rv = self.app.get('/')
assert b'No entries here so far' in rv.data
Task tags
Students who completed this task
Moses Paul