Fix test_custom_resource test

Adapt the test to the (current) breaking change in this PR.
This commit is contained in:
Luke Hoban 2020-01-03 16:04:38 -08:00 committed by Pat Gavlin
parent 9d6edeac1c
commit b8c864a559
2 changed files with 7 additions and 5 deletions

View file

@ -108,7 +108,7 @@ async def serialize_property(value: 'Input[Any]',
urn = await serialize_property(value.urn, deps, input_transformer) urn = await serialize_property(value.urn, deps, input_transformer)
return { return {
_special_sig_key: _special_resource_sig, _special_sig_key: _special_resource_sig,
urn: urn, "urn": urn,
} }
if known_types.is_asset(value): if known_types.is_asset(value):

View file

@ -34,8 +34,8 @@ class FakeCustomResource:
Fake CustomResource class that duck-types to the real CustomResource. Fake CustomResource class that duck-types to the real CustomResource.
This class is substituted for the real CustomResource for the below test. This class is substituted for the real CustomResource for the below test.
""" """
def __init__(self, id): def __init__(self, urn):
self.id = id self.urn = Output.from_input(urn)
def async_test(coro): def async_test(coro):
@ -85,11 +85,13 @@ class NextSerializationTests(unittest.TestCase):
@async_test @async_test
async def test_custom_resource(self): async def test_custom_resource(self):
res = FakeCustomResource("some-id") fake_urn = "urn:pulumi:mystack::myproject::my:mod:Fake::fake"
res = FakeCustomResource(fake_urn)
deps = [] deps = []
prop = await rpc.serialize_property(res, deps) prop = await rpc.serialize_property(res, deps)
self.assertListEqual([res], deps) self.assertListEqual([res], deps)
self.assertEqual("some-id", prop) self.assertEqual(rpc._special_resource_sig, prop[rpc._special_sig_key])
self.assertEqual(fake_urn, prop["urn"])
@async_test @async_test
async def test_string_asset(self): async def test_string_asset(self):