File: test_network_sources.py

package info (click to toggle)
chirp 1%3A20251108-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,728 kB
  • sloc: python: 156,369; ansic: 296; sh: 219; xml: 24; makefile: 19
file content (28 lines) | stat: -rw-r--r-- 1,030 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 unittest
from unittest import mock

from chirp.sources import dmrmarc

# Hopefully this will provide a sentinel and forcing function for
# network sources when APIs stop working. Unfortunately, live queries
# are more likely to add spurious failures into the tests, but time
# will tell if it's worth it.


class TestDMRMARC(unittest.TestCase):
    def test_marc_works(self):
        r = dmrmarc.DMRMARCRadio()
        r.do_fetch(mock.MagicMock(), {'city': 'portland',
                                      'state': 'oregon',
                                      'country': ''})
        f = r.get_features()

        # Assert that we found some repeaters. If they all go away in
        # Portland, this will break and we will need another target
        self.assertGreater(f.memory_bounds[1], 2)

        for i in range(*f.memory_bounds):
            m = r.get_memory(i)
            self.assertEqual('DMR', m.mode)
            # Assume all DMR repeaters are above 100MHz
            self.assertGreater(m.freq, 100000000)