예제 #1
0
    def test_guestbook(self, client: Client):
        contract = path.join(MACROS_CONTRACT_PATH, 'guestbook.tz')

        init_with_transfer(
            client,
            contract,
            '{ Elt "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" None }',
            100,
            'bootstrap1',
        )

        assert_transfer_failwith(
            client,
            0,
            'bootstrap2',
            'guestbook',
            ['--arg', '"Pas moi"', '--burn-cap', '10'],
        )

        client.transfer(
            0,
            'bootstrap1',
            'guestbook',
            ['-arg', '"Coucou"', '--burn-cap', '10'],
        )
        bake(client)
        assert_storage_contains(
            client,
            'guestbook',
            '{ Elt "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" (Some "Coucou") }',
        )

        assert_transfer_failwith(
            client,
            0,
            'bootstrap3',
            'guestbook',
            ['--arg', '"Pas moi non plus"', '--burn-cap', '10'],
        )
        assert_transfer_failwith(
            client,
            0,
            'bootstrap1',
            'guestbook',
            ['--arg', '"Recoucou ?"', '--burn-cap', '10'],
        )
예제 #2
0
    def test_bigmap(self, client: Client):
        contract = path.join(MACROS_CONTRACT_PATH, 'big_map_mem.tz')

        init_with_transfer(
            client, contract,
            '(Pair { Elt 1 Unit ; Elt 2 Unit ; Elt 3 Unit } Unit)', 100,
            'bootstrap1')

        client.transfer(1, 'bootstrap1', 'big_map_mem',
                        ['-arg', '(Pair 0 False)', '--burn-cap', '10'])
        bake(client)

        assert_transfer_failwith(
            client, 0, 'bootstrap1', 'big_map_mem',
            ['--arg', '(Pair 0 True)', '--burn-cap', '10'])

        client.transfer(1, 'bootstrap1', 'big_map_mem',
                        ['--arg', '(Pair 0 False)', '--burn-cap', '10'])
        bake(client)
        assert_transfer_failwith(
            client, 1, 'bootstrap1', 'big_map_mem',
            ['--arg', '(Pair 0 True)', '--burn-cap', '10'])
        client.transfer(1, 'bootstrap1', 'big_map_mem',
                        ['--arg', '(Pair 1 True)', '--burn-cap', '10'])
        bake(client)
        assert_transfer_failwith(
            client, 1, 'bootstrap1', 'big_map_mem',
            ['--arg', '(Pair 1 False)', '--burn-cap', '10'])
        client.transfer(1, 'bootstrap1', 'big_map_mem',
                        ['--arg', '(Pair 2 True)', '--burn-cap', '10'])
        bake(client)
        assert_transfer_failwith(
            client, 1, 'bootstrap1', 'big_map_mem',
            ['--arg', '(Pair 2 False)', '--burn-cap', '10'])
        client.transfer(1, 'bootstrap1', 'big_map_mem',
                        ['--arg', '(Pair 3 True)', '--burn-cap', '10'])
        bake(client)
        assert_transfer_failwith(
            client, 1, 'bootstrap1', 'big_map_mem',
            ['--arg', '(Pair 3 False)', '--burn-cap', '10'])
        client.transfer(1, 'bootstrap1', 'big_map_mem',
                        ['--arg', '(Pair 4 False)', '--burn-cap', '10'])
        bake(client)
        assert_transfer_failwith(
            client, 1, 'bootstrap1', 'big_map_mem',
            ['--arg', '(Pair 4 True)', '--burn-cap', '10'])