REST API Testing Framework

Quickly write unittests for your REST API and microservices with a familiar format based on MongoDBs query language.

class TwitterSuite(jsikel.OAuthTestSuite): consumer_key = 'consumer_key' consumer_secret = 'consumer_secret' access_token = 'access_token' access_token_secret = 'access_token_secret' base_url = 'https://api.twitter.com/1.1' @jsikel.append_to(TwitterSuite) class GetTest(jsikel.TestCase): method = 'GET' path = '/followers/list.json' expect_status = 200 input_params = { 'count': 200, } expect_json = { 'users': {'$has': { 'id': {'$type': 'number'}, 'screen_name': 'pritunl', 'name': {'$text': 'Pritunl'}, 'following': True, }}, } TwitterSuite.main()
class PritunlSuite(jsikel.SessionTestSuite): base_url = 'https://localhost:9700' method = 'POST' path = '/auth/session' expect_status = 200 input_json = { 'username': 'pritunl', 'password': 'pritunl', } @jsikel.append_to(PritunlSuite) class GetStatus(jsikel.TestCase): method = 'GET' path = '/status' expect_status = 200 expect_json = { 'user_count': {'$gt': 0, '$lt': 100}, 'users_online': 0, 'host_count': {'$not': {'$type': 'string'}}, 'server_version': {'$type': 'string'}, 'notification': '', 'test': {'$exists': False}, } PritunlSuite.main()