Page MenuHomePhabricator

Fix Flaky TWL Oauth test in CICD
Open, Needs TriagePublicBUG REPORT


One of our OAuth tests is flaky in CI, though it passes locally

def test_create_user_and_editor(self, mock_urlopen):
    OAuthBackend._create_user_and_editor() should:
    * create a user
        * with a suitable username and email
        * without a password
    * And a matching editor
    oauth_backend = OAuthBackend()
    oauth_data = FAKE_IDENTITY_DATA
    identity = FAKE_IDENTITY

    mock_response = Mock() = [json.dumps(oauth_data)] * 7
    mock_urlopen.return_value = mock_response

    user, editor = oauth_backend._create_user_and_editor(identity)

    self.assertEqual(, "")
    self.assertEqual(user.username, "567823")

    self.assertEqual(editor.user, user)
    self.assertEqual(editor.wp_sub, 567823)
    # We won't test the fields set by update_from_wikipedia, as they are
    # tested elsewhere.

For now, we're commenting out this test
but we should fix it

Related Objects