def test_get_username_fail(self, mock_stdin): assert manage._get_username() == 'jen'
def test_get_username_success(self, mock_stdin): assert manage._get_username() == 'jen'
def test_get_username(self, mock_get_usernam): assert manage._get_username() == 'foo-bar-baz'
def test_get_username_fail(): bad_username = '******' * (Journalist.MIN_USERNAME_LEN - 1) with mock.patch("manage.obtain_input", side_effect=[bad_username, 'jen']): assert manage._get_username() == 'jen'
def test_get_username_success(): with mock.patch("manage.obtain_input", return_value='jen'): assert manage._get_username() == 'jen'
def test_get_username(mocker): mocker.patch("manage.obtain_input", return_value='foo-bar-baz') assert manage._get_username() == 'foo-bar-baz'