Exemplo n.º 1
0
    def test_change_fallback_handler(self):
        safe_operator = self.setup_operator()
        safe = Safe(safe_operator.address, self.ethereum_client)
        current_fallback_handler = safe.retrieve_fallback_handler()
        with self.assertRaises(SameFallbackHandlerException):
            safe_operator.change_fallback_handler(current_fallback_handler)

        new_fallback_handler = Account.create().address
        self.assertTrue(
            safe_operator.change_fallback_handler(new_fallback_handler))
        self.assertEqual(safe_operator.safe_cli_info.fallback_handler,
                         new_fallback_handler)
        self.assertEqual(safe.retrieve_fallback_handler(),
                         new_fallback_handler)

        safe_operator.change_master_copy(self.safe_old_contract_address)
        with self.assertRaises(FallbackHandlerNotSupportedException):
            safe_operator.change_fallback_handler(Account.create().address)