def test_add_user_to_group(self): carl = User.objects.create( username='******', email='*****@*****.**', password='******' ) technical_assistants = get_ta_group() carl.groups.add(technical_assistants) self.assertEquals(list(carl.groups.all()), [technical_assistants])
def test_user_added_to_appropriate_group(self): allen = User.objects.create( username='******', email='*****@*****.**', password='******' ) bob = User.objects.create( username='******', email='*****@*****.**', password='******' ) carl = User.objects.create( username='******', email='*****@*****.**', password='******' ) # TODO: Figure out why this test won't work while I have # confirmed the signal is being received in the django # shell. I believe there's something going on with the many to # many field during testing, very bizarre. technical_assistants = get_ta_group() self.assertTrue(technical_assistants in allen.groups.all()) self.assertTrue(technical_assistants not in bob.groups.all()) self.assertTrue(technical_assistants in carl.groups.all())