def testForRoleForOneOrg(self): """Tests that the user does not have roles for organization anymore.""" self.profile.mentor_for = [self.org.key] self.profile.admin_for = [self.org.key] self.profile.put() profile_logic.assignNoRoleForOrg(self.profile, self.org.key) self.assertFalse(self.profile.is_mentor) self.assertListEqual(self.profile.mentor_for, []) self.assertFalse(self.profile.is_admin) self.assertListEqual(self.profile.admin_for, [])
def testForRoleForManyOrgs(self): """Tests that the user still have roles for other organizations.""" # seed another organization other_org = org_utils.seedOrganization(self.program.key()) self.profile.mentor_for = [self.org.key, other_org.key] self.profile.org_admin_for = [self.org.key] self.profile.put() profile_logic.assignNoRoleForOrg(self.profile, self.org.key) self.assertTrue(self.profile.is_mentor) self.assertListEqual(self.profile.mentor_for, [other_org.key]) self.assertFalse(self.profile.is_admin) self.assertListEqual(self.profile.admin_for, [])