@mock.patch('certbot._internal.log.post_arg_parse_setup')
def test_register(self, _):
    with mock.patch('certbot._internal.main.client') as mocked_client:
        acc = mock.MagicMock()
        acc.id = 'imaginary_account'
        mocked_client.register.return_value = (acc, 'worked')
        self._call_no_clientmock(['register', '--email', 'example@example.com'])
        with mock.patch('certbot._internal.main.account') as mocked_account:
            mocked_storage = mock.MagicMock()
            mocked_account.AccountFileStorage.return_value = mocked_storage
            mocked_storage.find_all.return_value = ['an account']
            x = self._call_no_clientmock(['register', '--email', 'example@example.com'])
            self.assertTrue(('There is an existing account' in x[0]))
@mock.patch('certbot._internal.log.post_arg_parse_setup')
def test_register(self, _):
    with mock.patch('certbot._internal.main.client') as mocked_client:
        acc = mock.MagicMock()
        acc.id = 'imaginary_account'
        mocked_client.register.return_value = (acc, 'worked')
        self._call_no_clientmock(['register', '--email', 'example@example.com'])
        with mock.patch('certbot._internal.main.account') as mocked_account:
            mocked_storage = mock.MagicMock()
            mocked_account.AccountFileStorage.return_value = mocked_storage
            mocked_storage.find_all.return_value = ['an account']
            x = self._call_no_clientmock(['register', '--email', 'example@example.com'])
            self.assertTrue(('There is an existing account' in x[0]))