def test_account_info(app, example_orcid):
    """Test account info extraction."""
    client = app.test_client()
    ioc = app.extensions['oauthlib.client']
    # Ensure remote apps have been loaded (due to before first
    # request)
    client.get(url_for('invenio_oauthclient.login', remote_app='orcid'))

    example_data, example_account_info = example_orcid

    assert account_info(ioc.remote_apps['orcid'],
                        example_data) == example_account_info

    assert account_info(ioc.remote_apps['orcid'], {}) == \
        dict(external_id=None, external_method='orcid', user=dict(profile=dict(
            full_name=None)))
def test_account_info(app, example_orcid):
    """Test account info extraction."""
    client = app.test_client()
    ioc = app.extensions['oauthlib.client']
    # Ensure remote apps have been loaded (due to before first
    # request)
    client.get(url_for("invenio_oauthclient.login", remote_app='orcid'))

    example_data, example_account_info = example_orcid

    assert account_info(
        ioc.remote_apps['orcid'], example_data) == example_account_info

    assert account_info(ioc.remote_apps['orcid'], {}) == \
        dict(external_id=None,
             external_method="orcid",
             user=dict())
    def test_account_info(self):
        """Test account info extraction."""
        from invenio_oauthclient.client import oauth
        # Ensure remote apps have been loaded (due to before first
        # request)
        self.client.get(url_for("oauthclient.login", remote_app='orcid'))

        self.assertEqual(
            account_info(oauth.remote_apps['orcid'], self.example_data),
            dict(external_id="0000-0002-1825-0097",
                 external_method="orcid",
                 nickname="0000-0002-1825-0097")
        )
        self.assertEqual(
            account_info(oauth.remote_apps['orcid'], {}),
            dict(external_id=None,
                 external_method="orcid",
                 nickname=None)
        )
    def test_account_info(self):
        """Test account info extraction."""
        from invenio_oauthclient.client import oauth
        # Ensure remote apps have been loaded (due to before first
        # request)
        self.client.get(url_for("oauthclient.login", remote_app='orcid'))

        self.assertEqual(
            account_info(oauth.remote_apps['orcid'], self.example_data),
            dict(external_id="0000-0002-1825-0097",
                 external_method="orcid",
                 nickname="0000-0002-1825-0097")
        )
        self.assertEqual(
            account_info(oauth.remote_apps['orcid'], {}),
            dict(external_id=None,
                 external_method="orcid",
                 nickname=None)
        )