File: test_repeaterbook.py

package info (click to toggle)
chirp 1%3A20221106%2Bpy3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,144 kB
  • sloc: python: 119,334; ansic: 296; sh: 184; makefile: 41
file content (28 lines) | stat: -rw-r--r-- 953 bytes parent folder | download | duplicates (2)
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
26
27
28
import tempfile
import unittest

from chirp import chirp_common
from chirp.drivers import repeaterbook


class TestRepeaterBook(unittest.TestCase):
    def _fetch_and_load(self, query):
        fn = tempfile.mktemp('.csv')
        chirp_common.urlretrieve(query, fn)
        radio = repeaterbook.RBRadio(fn)
        return fn, radio

    def test_political(self):
        query = "http://www.repeaterbook.com/repeaters/downloads/chirp.php" + \
            "?func=default&state_id=%s&band=%s&freq=%%&band6=%%&loc=%%" + \
            "&county_id=%s&status_id=%%&features=%%&coverage=%%&use=%%"
        query = query % ('41', '%%', '005')
        self._fetch_and_load(query)

    def test_proximity(self):
        loc = '97124'
        band = '%%'
        dist = '20'
        query = "https://www.repeaterbook.com/repeaters/downloads/CHIRP/" \
                "app_direct.php?loc=%s&band=%s&dist=%s" % (loc, band, dist)
        self._fetch_and_load(query)