Added /p/create entry point to create new projects.

This requires the user to be logged in. The project will be owned by that
user.
This commit is contained in:
2016-04-19 16:00:32 +02:00
parent c3f0882a10
commit 4b9dd29ad5
10 changed files with 311 additions and 83 deletions

View File

@@ -46,6 +46,7 @@ class AbstractPillarTest(TestMinimal):
from application import app
logging.getLogger('').setLevel(logging.DEBUG)
logging.getLogger('application').setLevel(logging.DEBUG)
logging.getLogger('werkzeug').setLevel(logging.DEBUG)
logging.getLogger('eve').setLevel(logging.DEBUG)
@@ -95,7 +96,7 @@ class AbstractPillarTest(TestMinimal):
return found['_id'], found
def create_user(self):
def create_user(self, roles=('subscriber', )):
with self.app.test_request_context():
users = self.app.data.driver.db['users']
assert isinstance(users, pymongo.collection.Collection)
@@ -106,7 +107,7 @@ class AbstractPillarTest(TestMinimal):
'_created': datetime.datetime(2016, 4, 15, 13, 15, 11, tzinfo=tz_util.utc),
'username': 'tester',
'groups': [],
'roles': ['subscriber'],
'roles': list(roles),
'settings': {'email_communications': 1},
'auth': [{'token': '',
'user_id': unicode(BLENDER_ID_TEST_USERID),
@@ -117,6 +118,17 @@ class AbstractPillarTest(TestMinimal):
return result.inserted_id
def create_valid_auth_token(self, user_id, token='token'):
now = datetime.datetime.now(tz_util.utc)
future = now + datetime.timedelta(days=1)
with self.app.test_request_context():
from application.utils import authentication as auth
token_data = auth.store_token(user_id, token, future, None)
return token_data
def mock_blenderid_validate_unhappy(self):
"""Sets up Responses to mock unhappy validation flow."""