def test_get_slack_username_by_github_username_without_username( self, slack_client, name_lookup): """ Test getting a slack username without a name passed in. """ slack_client.return_value = {'members': self.USERS} name_lookup.return_value = FULL_NAME username = slack._get_slack_username_by_github_username(None) self.assertIsNone(username)
def test_get_slack_username_by_github_username_with_match( self, slack_client, name_lookup): """ Test getting a matching slack and github username. """ slack_client.return_value = {'members': self.USERS} name_lookup.return_value = FULL_NAME username = slack._get_slack_username_by_github_username( GENERIC_USERNAME) self.assertEqual(username, GENERIC_USERNAME)
def test_get_slack_username_by_github_username_without_match( self, slack_client, name_lookup): """ Test getting a slack username without a match from github. """ different_username = '******' modified_user = self.USERS[0].copy() modified_user.update({'name': different_username}) slack_client.return_value = {'members': [modified_user]} name_lookup.return_value = FULL_NAME username = slack._get_slack_username_by_github_username( GENERIC_USERNAME) self.assertEqual(username, different_username)