Skip to content

sift_py.grpc.transport_test

CLASS DESCRIPTION
AuthInterceptor
DataService
ForceFailInterceptor

Force RPC to fail a few times before letting it pass.

FUNCTION DESCRIPTION
server_spy
test_internal_error_retry
test_sift_channel

AuthInterceptor

Bases: ServerInterceptor

METHOD DESCRIPTION
intercept
ATTRIBUTE DESCRIPTION
AUTH_REGEX

AUTH_REGEX class-attribute instance-attribute

AUTH_REGEX = compile('^Bearer (.+)$')

intercept

intercept(
    method: Callable,
    request_or_iterator: Any,
    context: ServicerContext,
    method_name: str,
) -> Any

DataService

Bases: DataServiceServicer

METHOD DESCRIPTION
GetData

GetData

GetData(request: GetDataRequest, context: ServicerContext)

ForceFailInterceptor

ForceFailInterceptor(
    expected_num_fails: int,
    failure_code: StatusCode = UNKNOWN,
)

Bases: ServerInterceptor

Force RPC to fail a few times before letting it pass.

failed_attempts: Count of how many times failed expected_num_fails: How many times you want call to fail

METHOD DESCRIPTION
intercept
ATTRIBUTE DESCRIPTION
expected_num_fails

TYPE: int

failed_attempts

TYPE: int

failure_code

TYPE: StatusCode

expected_num_fails instance-attribute

expected_num_fails: int = expected_num_fails

failed_attempts instance-attribute

failed_attempts: int = 0

failure_code instance-attribute

failure_code: StatusCode = failure_code

intercept

intercept(
    method: Callable,
    request_or_iterator: Any,
    context: ServicerContext,
    method_name: str,
) -> Any

server_spy

server_spy(
    mocker: MockFixture, *interceptors: ServerInterceptor
) -> Iterator[MockType]

test_internal_error_retry

test_internal_error_retry(mocker: MockFixture)

test_sift_channel

test_sift_channel(mocker: MockFixture)