Eschews obfuscation
This commit is contained in:
parent
561e254315
commit
e3126620b3
|
@ -58,7 +58,7 @@ class WorkflowService(object):
|
|||
|
||||
@staticmethod
|
||||
def delete_test_data():
|
||||
for study in db.session.query(StudyModel).filter_by(user_uid="test"):
|
||||
for study in db.session.query(StudyModel).filter_by(StudyModel.user_uid == "test"):
|
||||
StudyService.delete_study(study.id)
|
||||
db.session.commit()
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ class BaseTest(unittest.TestCase):
|
|||
|
||||
auths = {}
|
||||
test_uid = "dhf8r"
|
||||
flask_globals = g
|
||||
|
||||
users = [
|
||||
{
|
||||
|
@ -99,7 +98,7 @@ class BaseTest(unittest.TestCase):
|
|||
|
||||
def tearDown(self):
|
||||
ExampleDataLoader.clean_db()
|
||||
self.flask_globals.user = None
|
||||
g.user = None
|
||||
self.auths = {}
|
||||
|
||||
def logged_in_headers(self, user=None, redirect_url='http://some/frontend/url'):
|
||||
|
@ -118,8 +117,8 @@ class BaseTest(unittest.TestCase):
|
|||
user_model = session.query(UserModel).filter_by(uid=uid).first()
|
||||
self.assertIsNotNone(user_model.display_name)
|
||||
self.assertEqual(user_model.uid, uid)
|
||||
self.assertTrue('user' in self.flask_globals, 'User should be in Flask globals')
|
||||
self.assertEqual(uid, self.flask_globals.user.uid, 'Logged in user should match given user uid')
|
||||
self.assertTrue('user' in g, 'User should be in Flask globals')
|
||||
self.assertEqual(uid, g.user.uid, 'Logged in user should match given user uid')
|
||||
|
||||
return dict(Authorization='Bearer ' + user_model.encode_auth_token().decode())
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ import json
|
|||
import random
|
||||
import string
|
||||
|
||||
from flask import g
|
||||
|
||||
from tests.base_test import BaseTest
|
||||
from crc import session, db
|
||||
from crc.models.approval import ApprovalModel, ApprovalStatus
|
||||
|
@ -141,8 +143,8 @@ class TestApprovals(BaseTest):
|
|||
self.assertEqual('two_forms', workflow_api.workflow_spec_id)
|
||||
|
||||
# Log current user out.
|
||||
self.flask_globals.user = None
|
||||
self.assertIsNone(self.flask_globals.user)
|
||||
g.user = None
|
||||
self.assertIsNone(g.user)
|
||||
|
||||
# Complete the form for Step one and post it.
|
||||
self.complete_form(workflow, workflow_api.next_task, {"color": "blue"}, error_code=None, user_uid=workflow.study.user_uid)
|
||||
|
|
Loading…
Reference in New Issue