<gh_stars>1-10
import os

import pytest

from pygraphql.auth import BaseAuth


class Request:
    def __init__(self):
        self.headers = {}


def test_BaseAuth_simple():
    auth = BaseAuth(token="<PASSWORD>")
    request = Request()
    request = next(auth.auth_flow(request))
    assert request.headers["Authorization"] == "bearer blabla"


def test_BaseAuth_env():
    os.environ["GRAPHQL_AUTH_TOKEN"] = "<PASSWORD>"
    auth = BaseAuth()
    request = Request()
    request = next(auth.auth_flow(request))
    assert request.headers["Authorization"] == "bearer blibli"


def test_BaseAuth_assertion_error():
    del os.environ["GRAPHQL_AUTH_TOKEN"]
    with pytest.raises(AssertionError):
        BaseAuth()

import os

import pytest

from pygraphql.auth import BaseAuth


class Request:
    def __init__(self):
        self.headers = {}


def test_BaseAuth_simple():
    auth = BaseAuth(token="<PASSWORD>")
    request = Request()
    request = next(auth.auth_flow(request))
    assert request.headers["Authorization"] == "bearer blabla"


def test_BaseAuth_env():
    os.environ["GRAPHQL_AUTH_TOKEN"] = "<PASSWORD>"
    auth = BaseAuth()
    request = Request()
    request = next(auth.auth_flow(request))
    assert request.headers["Authorization"] == "bearer blibli"


def test_BaseAuth_assertion_error():
    del os.environ["GRAPHQL_AUTH_TOKEN"]
    with pytest.raises(AssertionError):
        BaseAuth()