def test_contract_native_compiler_set_account(chain_fixture, compiler_fixture):
    identity_contract = "contract Identity =\n  entrypoint main(x : int) = x"
    account = chain_fixture.ALICE
    try:
        contract_native = ContractNative(
            client=chain_fixture.NODE_CLI,
            source=identity_contract,
            compiler=compiler_fixture.COMPILER.compiler_url,
            account='ak_11111')
        raise RuntimeError("Method call should fail")
    except Exception as e:
        assert str(
            e
        ) == 'Invalid account type. Use `class Account` for creating an account'

    contract_native = ContractNative(
        client=chain_fixture.NODE_CLI,
        source=identity_contract,
        compiler=compiler_fixture.COMPILER.compiler_url,
        account=account)

    try:
        contract_native.set_account(None)
        raise RuntimeError("Method call should fail")
    except Exception as e:
        assert str(e) == 'Account can not be of None type'

    try:
        contract_native.set_account('ak_111111')
        raise RuntimeError("Method call should fail")
    except Exception as e:
        assert str(
            e
        ) == 'Invalid account type. Use `class Account` for creating an account'
def test_contract_native_default_account_overriding(compiler_fixture,
                                                    chain_fixture):
    identity_contract = "contract Identity =\n  entrypoint main(x : int) = x"
    compiler = compiler_fixture.COMPILER
    account = chain_fixture.ALICE
    contract_native = ContractNative(client=chain_fixture.NODE_CLI,
                                     source=identity_contract,
                                     compiler=compiler,
                                     account=account)
    contract_native.deploy()
    assert (contract_native.address is not None)
    call_info, _ = contract_native.main(12)
    assert (call_info.caller_id == chain_fixture.ALICE.get_address())

    call_info, _ = contract_native.main(12, account=chain_fixture.BOB)
    assert (call_info.caller_id == chain_fixture.BOB.get_address())

    contract_native.set_account(chain_fixture.BOB)
    call_info, _ = contract_native.main(12)
    assert (call_info.caller_id == chain_fixture.BOB.get_address())