1

I'm doing something like this, but the invalid scenario assertion fails.

Is there a way to propagate the exception from the other contract? Or do I just have to test that contract separately?


class TezosHomepageAdNft(FA2):
@sp.entry_point
    def mint(self, params):
      sp.failwith("fail")

class TezosHomepage(sp.Contract):
@sp.entry_point
    def buy(self, params):
        sp.transfer(token_params, sp.tez(0), land_nft_contract)  # calling mint here

def test():
    scenario = sp.test_scenario()
    t_home = TezosHomepage()
    
    scenario += t_home
    scenario += t_home.buy().run(sender = mark, amount = sp.mutez(1), valid=False)
2

SmartPy test interpreter already handles internal operations failures really well.

Here is an example: https://smartpy.io/ide?cid=QmV3nwdkwHGXdJbWwV8LDgm3TPbC49Es7Wm6GufMeh8Pz2&k=184987b7b8089b73396a

Please, don't provide incomplete examples. I always find myself wasting tremendous amounts of time just to put those examples to work.

1
  • 1
    sorry about that. I'll include a link to smartpy ide example next time. this time it was a user error... had a hardcoded contract address when I should've been using the one instantiated in the scenario – Jaime Apr 9 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.