def test_authenticating_users(self): """Tests the authentication of users""" # Creates the users user1 = FomoUser() user1.first_name = 'Stephane' user1.last_name = 'Akoki' user1.set_password('baseball') user1.date_joined = datetime.now() user1.last_login = datetime.now() user1.username = '******' user1.email = '*****@*****.**' user1.phone = '336-486-4595' user1.address = '1960 N Canyon Rd' user1.city = 'Provo' user1.state = 'Utah' user1.zip_code = '84604' user1.is_superuser = True user1.is_staff = True user1.is_active = True user1.save() #pull back off of the database user1auth = authenticate(username=user1.username, password='******') u2 = FomoUser.objects.get(username='******') self.assertEqual(u2, user1auth)
g3.permissions.add(Permission.objects.get(codename=('View_products'))) g3.permissions.add(Permission.objects.get(codename=('View_users'))) g3.permissions.add(Permission.objects.get(codename=('change_fomouser'))) #Query all / some with different query OPTIONS # 3 - 5 examples u1 = FomoUser() u1.first_name = "Stephane" u1.last_name = "Akoki" u1.username = "******" u1.set_password("jeuvideo") u1.address = "Provo" u1.zip = '84604' u1.date_joined = datetime.now() u1.last_login = datetime.now() u1.email = "*****@*****.**" u1.phone_number = "8013863392" u1.city = "Provo" u1.state = "UT" u1.is_staff = True u1.is_active = True u1.save() u2 = FomoUser() u2.first_name = "Xavier" u2.last_name = "Akoki" u2.username = "******" u2.set_password("jeuvideo") u2.address = "Draper" u2.zip = '84604'