def setUp(self): self.db_fd, app.config['DATABASE'] = tempfile.mkstemp() app.config['TESTING'] = True commands.init_db() commands.load_data(filepath('test-data.json')) self.client = app.test_client() with open(filepath('test-patch-replace-values-1.json')) as f: self.patch = f.read() with app.app_context(): self.unauthorized_identity = auth.add_user_or_update_credentials({ 'name': 'Dangerous Dan', 'access_token': 'f7e00c02-6f97-4636-8499-037446d95446', 'expires_in': 631138518, 'orcid': '0000-0000-0000-000X', }) db = database.get_db() curs = db.cursor() curs.execute('UPDATE user SET permissions = ? WHERE name = ?', ('[]', 'Dangerous Dan')) self.user_identity = auth.add_user_or_update_credentials({ 'name': 'Regular Gal', 'access_token': '5005eb18-be6b-4ac0-b084-0443289b3378', 'expires_in': 631138518, 'orcid': '1234-5678-9101-112X', }) self.admin_identity = auth.add_user_or_update_credentials({ 'name': 'Super Admin', 'access_token': 'f7c64584-0750-4cb6-8c81-2932f5daabb8', 'expires_in': 3600, 'orcid': '1211-1098-7654-321X', }, (ActionNeed('accept-patch'),)) db.commit()
def setUp(self): self.db_fd, app.config['DATABASE'] = tempfile.mkstemp() app.config['TESTING'] = True self.client = app.test_client() commands.init_db() with app.app_context(): self.identity = auth.add_user_or_update_credentials( {'name': 'Testy Testerson', 'access_token': '5005eb18-be6b-4ac0-b084-0443289b3378', 'expires_in': 631138518, 'orcid': '1234-5678-9101-112X'}) self.expired_identity = auth.add_user_or_update_credentials({ 'name': 'Eric Expired', 'access_token': 'f7c64584-0750-4cb6-8c81-2932f5daabb8', 'expires_in': -3600, 'orcid': '1211-1098-7654-321X', }) database.commit()
def setUp(self): self.db_fd, app.config['DATABASE'] = tempfile.mkstemp() app.config['TESTING'] = True self.client = app.test_client() commands.init_db() commands.load_data(filepath('test-data.json')) with app.app_context(): self.user_identity = auth.add_user_or_update_credentials({ 'name': 'Regular Gal', 'access_token': '5005eb18-be6b-4ac0-b084-0443289b3378', 'expires_in': 631138518, 'orcid': '1234-5678-9101-112X', }) self.admin_identity = auth.add_user_or_update_credentials({ 'name': 'Super Admin', 'access_token': 'f7c64584-0750-4cb6-8c81-2932f5daabb8', 'expires_in': 3600, 'orcid': '1211-1098-7654-321X', }, (ActionNeed('accept-patch'),)) database.commit()