def test_post_unicode(self): # # Create user # user = User() user.name = 'Test' user.username = '******' user.email = '*****@*****.**' user.set_password('abc123') user.is_active = True user.save() # # Create meme meme = Meme() meme.name = 'MemeName' meme.code = 'meme' meme.image = None meme.owner = user meme.save() # # Create post # post = Post() post.header = 'HeaderText' post.footer = 'FooterText' post.owner = user post.meme = meme post.save() # # Test # self.assertEqual(unicode(post), 'HeaderText ~ MemeName ~ FooterText')
def handle(self, *args, **options): # # Create superuser # broak = User() broak.name = 'Broak' broak.email = '*****@*****.**' broak.username = '******' broak.is_active = True broak.is_staff = True broak.is_superuser = True broak.set_password('abc123') broak.save() self.user_msg(broak) # # Create memes # meme = Meme() meme.name = 'Bachelor Frog' meme.code = 'bachelor-frog' meme.owner = broak meme.save() self.meme_msg(meme) meme = Meme() meme.name = 'Insanity Wolf' meme.code = 'insanity-wolf' meme.owner = broak meme.save() self.meme_msg(meme) meme = Meme() meme.name = 'Philosoraptor' meme.code = 'Philosoraptor' meme.owner = broak meme.save() self.meme_msg(meme)
def test_user_email_user(self): try: u = User() u.name = 'Batman' u.username = '******' u.email = '*****@*****.**' u.set_password('abc123') u.is_superuser = True u.is_active = True u.is_staff = True u.save() u.email_user('Hello', 'World', from_email='*****@*****.**') is_valid = True except Exception: is_valid = False self.assertTrue(is_valid)
def test_relationship_clean(self): # # Create user # user = User() user.name = 'FlusFlis' user.username = '******' user.email = '*****@*****.**' user.set_password('Fr3nCh') user.is_active = True user.save() # # Create relationship # rel = Friendship() rel.owner = user rel.friend = user # # Test clean # self.assertRaises(ValidationError, rel.clean)