def setUp(self): from nokkhumapi import main from webtest import TestApp settings = {'mongodb.db_name': 'nokkhum', 'mongodb.host': 'localhost', 'nokkhum.auth.secret': 'nokkhum'} app = main({}, **settings) self.testapp = TestApp(app) args = dict(password_credentials= {"username": "******", "password": "******"} ) response = self.testapp.post_json('/authentication/tokens', params=args, status=200) self.pp=pprint.PrettyPrinter(indent=4) self.pp.pprint(response.json) self.token = response.json['access']['token']['id'] self.user_id = response.json['access']['user']['id'] user_projects = self.testapp.get('/users/%s/projects'%self.user_id, headers=[('X-Auth-Token', self.token)], status=200) self.project_id = user_projects.json['projects'][0]['id']
def setUp(self): from nokkhumapi import main cfg = configparser.ConfigParser() cfg.read('../../../development.ini') settings = dict(cfg.items('app:main')) app = main({}, **settings) from webtest import TestApp self.testapp = TestApp(app) args = dict(password_credentials= {"email": "*****@*****.**", "password": "******"} ) response = self.testapp.post_json('/authentication/tokens', params=args, status=200) print("authentication: ") self.pp=pprint.PrettyPrinter(indent=4) self.pp.pprint(response.json) self.token = response.json['access']['token']['id'] self.status_name = 'active' self.user_id = 1
def setUp(self): from nokkhumapi import main settings = {'mongodb.db_name': 'nokkhum', 'mongodb.host': 'localhost', 'nokkhum.auth.secret': 'nokkhum'} app = main({}, **settings) from webtest import TestApp self.testapp = TestApp(app) self.pp=pprint.PrettyPrinter(indent=4)
def setUp(self): from nokkhumapi import main cfg = configparser.ConfigParser() cfg.read("../../../development.ini") settings = dict(cfg.items("app:main")) app = main({}, **settings) from webtest import TestApp self.testapp = TestApp(app) args = dict(password_credentials={"username": "******", "password": "******"}) response = self.testapp.post_json("/authentication/tokens", params=args, status=200) print("authentication: ") self.pp = pprint.PrettyPrinter(indent=4) self.pp.pprint(response.json) self.token = response.json["access"]["token"]["id"] self.user = response.json["access"]["user"]