'Asserts first party auth was used in place of third party auth.
Args:
email: string. The user\'s email. If not None, will be set on POST.
password: string. The user\'s password. If not None, will be set on
POST.
success: None or bool. Whether we expect auth to be successful. Set
to None to indicate we expect the request to be invalid (meaning
one of username or password will be missing).'

def assert_first_party_auth_trumps_third_party_auth(self, email=None, password=None, success=None):

    (_, strategy) = self.get_request_and_strategy(auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
    strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
    self.create_user_models_for_existing_account(strategy, email, password, self.get_username(), skip_social_auth=True)
    strategy.request.POST = dict(strategy.request.POST)
    if email:
        strategy.request.POST['email'] = email
    if password:
        strategy.request.POST['password'] = (('bad_' + password) if (success is False) else password)
    self.assert_pipeline_running(strategy.request)
    payload = json.loads(student_views.login_user(strategy.request).content)
    if (success is None):
        self.assertFalse(payload.get('success'))
        self.assertIn('There    was    an    error    receiving    your    login    information', payload.get('value'))
    elif success:
        self.assertTrue(payload.get('success'))
    else:
        self.assertFalse(payload.get('success'))
        self.assertIn('incorrect', payload.get('value'))
