def test_create_comment(self): u = User.register('*****@*****.**', 'testing', 'James Curran is love') p = Post.create( User.get('*****@*****.**').user_id, 'some random location', 'James Currans secret post', 'default.jpg', '50') c = Comment.create(p.author_id, p.id, 'This is a comment.') self.assertEqual(c.content, 'This is a comment.')
def test_create(self): u = User.register('*****@*****.**', 'testing', 'James Curran is love') p = Post.create( User.get('*****@*****.**').user_id, 'some random location', 'James Currans secret post', 'default.jpg', '50') print(p, p.author_id, User.get_by_id(p.author_id).email) self.assertEqual(u.username, 'James Curran is love')
def test_post(self): u = User.register( '*****@*****.**', 'tomtom', 'James Curran' ) p = Post.create( u.user_id, 'Title', 'Content', 'Image', 'Location' ) self.assertEqual( u.user_id, p.author_id )
def test_getuser(self): User.register( '*****@*****.**', 'tomtom', 'James Curran' ) u = User.get( '*****@*****.**' ) self.assertEqual( u.username, 'James Curran' )
def test_register_fail(self): User.register( '*****@*****.**', 'cranberry', 'James Currant' ) with self.assertRaises( ValueError ): User.register( '*****@*****.**', 'cranberry', 'James Currant' )