Fix tests that used to be skipped on missing async lib (#6941)

This commit is contained in:
Anton Tayanovskyy 2021-05-10 13:27:20 -04:00 committed by GitHub
parent dad7f2c2f0
commit d55327db50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,34 +14,32 @@
from typing import Dict, Any
import os
import pytest
from pulumi.runtime.proto.provider_pb2 import ConstructRequest
from pulumi.provider.server import ProviderServicer
from pulumi.runtime import proto, rpc
from pulumi.runtime.proto.provider_pb2 import ConstructRequest
import google.protobuf.struct_pb2 as struct_pb2
import pulumi.output
@pytest.mark.asyncio
async def test_construct_inputs_parses_request():
def test_construct_inputs_parses_request():
value = 'foobar'
inputs = _as_struct({'echo': value})
req = ConstructRequest(inputs=inputs)
inputs = ProviderServicer._construct_inputs(req)
assert len(inputs) == 1
fut_v = await inputs['echo'].future()
assert fut_v == value
assert inputs['echo'] == value
@pytest.mark.asyncio
async def test_construct_inputs_preserves_unknowns():
def test_construct_inputs_preserves_unknowns():
unknown = '04da6b54-80e4-46f7-96ec-b56ff0331ba9'
inputs = _as_struct({'echo': unknown})
req = ConstructRequest(inputs=inputs)
inputs = ProviderServicer._construct_inputs(req)
assert len(inputs) == 1
fut_v = await inputs['echo'].future()
assert fut_v is None
assert isinstance(inputs['echo'], pulumi.output.Unknown)
def _as_struct(key_values: Dict[str, Any]) -> struct_pb2.Struct: