Page MenuHomePhabricator

Fix Flaky TWL Oauth test in CICD
Open, LowPublic5 Estimated Story PointsBUG REPORT

Description

One of our OAuth tests is flaky in CI, though it passes locally
https://github.com/WikipediaLibrary/TWLight/blob/82cfe0f1ba45ff2e262d3080202d8318f965829c/TWLight/users/tests.py#L1659-L1684

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()
    mock_response.read.side_effect = [json.dumps(oauth_data)] * 7
    mock_urlopen.return_value = mock_response


    user, editor = oauth_backend._create_user_and_editor(identity)


    self.assertEqual(user.email, "alice@example.com")
    self.assertEqual(user.username, "567823")
    self.assertFalse(user.has_usable_password())


    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
https://github.com/WikipediaLibrary/TWLight/commit/3d2b8ba9a67c30e1d2b26f71798087ce00bcd171
but we should fix it

Event Timeline

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly pointed to the codebase URL and provide clear steps to help a contributor get setup for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3

Dillon subscribed.