def test_like_unicode(self): # # Create user # user = User.objects.create_user('user', '*****@*****.**', 'Pwd007', name='User') # # Create meme # meme = Meme() meme.code = 'testmeme' meme.name = 'Test Meme' meme.owner = user meme.save() # # Create post # post = Post() post.header = 'HeaderText' post.meme = meme post.footer = 'FooterText' post.owner = user post.save() # # Create like # like = Like() like.owner = user like.post = post like.save() # # Test # self.assertEqual(unicode(like), '{} -> {}'.format(unicode(user), unicode(post)))
def test_get_resource_path_like(self): # # Create user # user = User.objects.create_user('broak', '*****@*****.**', 'abc123', name='Broak') # # Create meme # meme = Meme() meme.code = 'bla' meme.name = 'Bla' meme.owner = user meme.save() # # Create post # post = Post() post.owner = user post.meme = meme post.header = 'Flus' post.footer = 'Flis' post.save() # # Create comment # like = Like() like.post = post like.owner = user like.save() # # Test resource path # path = utils.get_resource_path(like) self.assertEqual(path, '/likes/{}.{}'.format(like.pk, settings.API_FORMAT))