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

  • api-testing

Students who completed this task

Moses Paul

Task type

  • done_all Quality Assurance
close

2017