summaryrefslogtreecommitdiff
path: root/test/test_send_fake_sound_hit.py
blob: 61886cdeb32e3f0bf1be40e4f2ab9323e5d26655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3
import sys
import os.path
sys.path.extend([
    os.path.realpath(
        os.path.join(os.path.dirname(os.path.join(__file__)), '..')
    )
])

from argparse import ArgumentParser
from src.home.util import send_datagram, stringify, Addr


if __name__ == '__main__':
    parser = ArgumentParser()
    parser.add_argument('--name', type=str, required=True,
                        help='node name, like `diana`')
    parser.add_argument('--hits', type=int, required=True,
                        help='hits count')
    parser.add_argument('--server', type=str, required=True,
                        help='center server addr in host:port format')

    args = parser.parse_args()

    send_datagram(stringify([args.name, args.hits]), Addr.fromstring(args.server))