diff --git a/remo/dashboard/tests/test_models.py b/remo/dashboard/tests/test_models.py index 02e0aa438..b70ce8f01 100644 --- a/remo/dashboard/tests/test_models.py +++ b/remo/dashboard/tests/test_models.py @@ -84,10 +84,9 @@ def test_mentor_validation(self): ok_(not items.exists()) mentor = UserFactory.create(groups=['Rep', 'Mentor']) - user = UserFactory.create(groups=['Rep'], - userprofile__mentor=mentor) + UserFactory.create(groups=['Rep'], userprofile__mentor=mentor) - BugFactory.create(pending_mentor_validation=True, assigned_to=user) + BugFactory.create(pending_mentor_validation=True, assigned_to=mentor) items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) @@ -105,7 +104,7 @@ def test_mentor_change_update_action_items(self): user = UserFactory.create(groups=['Rep'], userprofile__mentor=mentor) - BugFactory.create(pending_mentor_validation=True, assigned_to=user) + BugFactory.create(pending_mentor_validation=True, assigned_to=mentor) new_mentor = UserFactory.create(groups=['Rep', 'Mentor']) user.userprofile.mentor = new_mentor @@ -121,11 +120,10 @@ def test_resolve_mentor_validation(self): ok_(not items.exists()) mentor = UserFactory.create(groups=['Rep', 'Mentor']) - user = UserFactory.create(groups=['Rep'], - userprofile__mentor=mentor) + UserFactory.create(groups=['Rep'], userprofile__mentor=mentor) bug = BugFactory.create(pending_mentor_validation=True, - assigned_to=user) + assigned_to=mentor) items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) diff --git a/remo/remozilla/models.py b/remo/remozilla/models.py index 2e0f9ff94..c1750eecc 100644 --- a/remo/remozilla/models.py +++ b/remo/remozilla/models.py @@ -98,7 +98,7 @@ def get_action_items(self): action_name = WAITING_MENTOR_VALIDATION_ACTION if self.assigned_to and user_is_rep(self.assigned_to): - mentor = self.assigned_to.userprofile.mentor + mentor = self.assigned_to if self.pending_mentor_validation: action_item = Item(action_name, mentor, ActionItem.BLOCKER, None) @@ -131,8 +131,8 @@ def save(self, *args, **kwargs): items.update(user=self.assigned_to) try: - current_mentor = current_bug.assigned_to.userprofile.mentor - new_mentor = self.assigned_to.userprofile.mentor + current_mentor = current_bug.assigned_to + new_mentor = self.assigned_to except AttributeError: current_mentor = None new_mentor = None