Fix schema and add test

This commit is contained in:
Daniel Ternyak 2019-01-28 15:34:57 -06:00
parent 893101b480
commit 77c02502be
No known key found for this signature in database
GPG Key ID: DF212D2DC5D0E245
2 changed files with 11 additions and 7 deletions

View File

@ -269,8 +269,9 @@ class UserSchema(ma.Schema):
return obj.id
user_schema = SelfUserSchema()
users_schema = SelfUserSchema(many=True)
user_schema = UserSchema()
users_schema = UserSchema(many=True)
class SocialMediaSchema(ma.Schema):
class Meta:

View File

@ -63,7 +63,6 @@ class TestUserAPI(BaseUserConfig):
}),
content_type="application/json"
)
print(user_auth_resp.headers)
self.assertEqual(user_auth_resp.json['emailAddress'], self.user.email_address)
self.assertEqual(user_auth_resp.json['displayName'], self.user.display_name)
@ -76,20 +75,24 @@ class TestUserAPI(BaseUserConfig):
}),
content_type="application/json"
)
print(login_resp.headers)
# should have session cookie now
me_resp = self.app.get(
"/api/v1/users/me"
)
print(me_resp.headers)
self.assert200(me_resp)
def test_me_get_includes_email_address(self):
self.login_default_user()
me_resp = self.app.get(
"/api/v1/users/me"
)
self.assert200(me_resp)
self.assertIsNotNone(me_resp.json['emailAddress'])
def test_user_auth_required_fail(self):
me_resp = self.app.get(
"/api/v1/users/me",
)
print(me_resp.json)
print(me_resp.headers)
self.assert401(me_resp)
def test_user_auth_bad_password(self):