'Given a user string, logs the given user in.
Used for testing with ddt, which does not have access to self in
decorators. If user is \'student_inactive\', then an inactive user will
be both created and logged in.'

def login(self, user):

    if (user == 'student_inactive'):
        student_inactive = UserFactory.create(password=self.test_password)
        self.client.login(username=student_inactive.username, password=self.test_password)
        student_inactive.is_active = False
        student_inactive.save()
    else:
        self.client.login(username=self.users[user].username, password=self.test_password)
