# Path: google/auth/_oauth2client.py
#     _HAS_APPENGINE = True
#     _HAS_APPENGINE = False
# _CONVERT_ERROR_TMPL = "Unable to convert {} to a google-auth credentials class."
# _CLASS_CONVERSION_MAP = {
#     oauth2client.client.OAuth2Credentials: _convert_oauth2_credentials,
#     oauth2client.client.GoogleCredentials: _convert_oauth2_credentials,
#     oauth2client.service_account.ServiceAccountCredentials: _convert_service_account_credentials,
#     oauth2client.service_account._JWTAccessCredentials: _convert_service_account_credentials,
#     oauth2client.contrib.gce.AppAssertionCredentials: _convert_gce_app_assertion_credentials,
# }
# def _convert_oauth2_credentials(credentials):
# def _convert_service_account_credentials(credentials):
# def _convert_gce_app_assertion_credentials(credentials):
# def _convert_appengine_app_assertion_credentials(credentials):
# def convert(credentials):


import datetime
import os
import sys
import mock
import oauth2client.client  # type: ignore
import oauth2client.contrib.gce  # type: ignore
import oauth2client.service_account  # type: ignore
import pytest  # type: ignore
    import oauth2client.contrib.appengine  # type: ignore
from six.moves import reload_module
from google.auth import _oauth2client
# See the License for the specific language governing permissions and
# limitations under the License.





DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
SERVICE_ACCOUNT_JSON_FILE = os.path.join(DATA_DIR, "service_account.json")


def test__convert_oauth2_credentials():
    old_credentials = oauth2client.client.OAuth2Credentials(
        "access_token",
        "client_id",
        "client_secret",
        "refresh_token",
        datetime.datetime.min,
        "token_uri",
        "user_agent",
        scopes="one two",
    )

    new_credentials = _oauth2client._convert_oauth2_credentials(old_credentials)

    assert new_credentials.token == old_credentials.access_token
    assert new_credentials._refresh_token == old_credentials.refresh_token
    assert new_credentials._client_id == old_credentials.client_id
    assert new_credentials._client_secret == old_credentials.client_secret
    assert new_credentials._token_uri == old_credentials.token_uri

# Path: google/auth/_oauth2client.py
#     _HAS_APPENGINE = True
#     _HAS_APPENGINE = False
# _CONVERT_ERROR_TMPL = "Unable to convert {} to a google-auth credentials class."
# _CLASS_CONVERSION_MAP = {
#     oauth2client.client.OAuth2Credentials: _convert_oauth2_credentials,
#     oauth2client.client.GoogleCredentials: _convert_oauth2_credentials,
#     oauth2client.service_account.ServiceAccountCredentials: _convert_service_account_credentials,
#     oauth2client.service_account._JWTAccessCredentials: _convert_service_account_credentials,
#     oauth2client.contrib.gce.AppAssertionCredentials: _convert_gce_app_assertion_credentials,
# }
# def _convert_oauth2_credentials(credentials):
# def _convert_service_account_credentials(credentials):
# def _convert_gce_app_assertion_credentials(credentials):
# def _convert_appengine_app_assertion_credentials(credentials):
# def convert(credentials):


# Path: tests/test__oauth2client.py
import datetime
import os
import sys
import mock
import oauth2client.client  # type: ignore
import oauth2client.contrib.gce  # type: ignore
import oauth2client.service_account  # type: ignore
import pytest  # type: ignore
    import oauth2client.contrib.appengine  # type: ignore
from six.moves import reload_module
from google.auth import _oauth2client

# See the License for the specific language governing permissions and
# limitations under the License.





DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
SERVICE_ACCOUNT_JSON_FILE = os.path.join(DATA_DIR, "service_account.json")


def test__convert_oauth2_credentials():
    old_credentials = oauth2client.client.OAuth2Credentials(
        "access_token",
        "client_id",
        "client_secret",
        "refresh_token",
        datetime.datetime.min,
        "token_uri",
        "user_agent",
        scopes="one two",
    )

    new_credentials = _oauth2client._convert_oauth2_credentials(old_credentials)

    assert new_credentials.token == old_credentials.access_token
    assert new_credentials._refresh_token == old_credentials.refresh_token
    assert new_credentials._client_id == old_credentials.client_id
    assert new_credentials._client_secret == old_credentials.client_secret
    assert new_credentials._token_uri == old_credentials.token_uri

    assert new_credentials.scopes == old_credentials.scopes