Example #1
0
    def test_import_mem(self, errors=[]):
        radio = FakeRadio(None)
        src_rf = chirp_common.RadioFeatures()
        mem = chirp_common.Memory()

        self.mox.StubOutWithMock(mem, 'dupe')
        self.mox.StubOutWithMock(import_logic, '_import_name')
        self.mox.StubOutWithMock(import_logic, '_import_power')
        self.mox.StubOutWithMock(import_logic, '_import_tone')
        self.mox.StubOutWithMock(import_logic, '_import_dtcs')
        self.mox.StubOutWithMock(import_logic, '_import_mode')
        self.mox.StubOutWithMock(import_logic, '_import_duplex')
        self.mox.StubOutWithMock(radio, 'validate_memory')

        mem.dupe().AndReturn(mem)
        import_logic._import_name(radio, src_rf, mem)
        import_logic._import_power(radio, src_rf, mem)
        import_logic._import_tone(radio, src_rf, mem)
        import_logic._import_dtcs(radio, src_rf, mem)
        import_logic._import_mode(radio, src_rf, mem)
        import_logic._import_duplex(radio, src_rf, mem)
        radio.validate_memory(mem).AndReturn(errors)

        self.mox.ReplayAll()

        import_logic.import_mem(radio, src_rf, mem)
Example #2
0
 def test_import_power_no_src(self):
     radio = FakeRadio(None)
     src_rf = chirp_common.RadioFeatures()
     mem = chirp_common.Memory()
     mem.power = None
     import_logic._import_power(radio, src_rf, mem)
     self.assertEqual(mem.power, radio.POWER_LEVELS[0])
Example #3
0
 def test_import_power_same(self):
     radio = FakeRadio(None)
     same_rf = radio.get_features()
     mem = chirp_common.Memory()
     mem.power = same_rf.valid_power_levels[0]
     import_logic._import_power(radio, same_rf, mem)
     self.assertEqual(mem.power, same_rf.valid_power_levels[0])
Example #4
0
 def test_import_power_no_dst(self):
     radio = FakeRadio(None)
     src_rf = radio.get_features()  # Steal a copy before we stub out
     self.mox.StubOutWithMock(radio, 'get_features')
     radio.get_features().AndReturn(chirp_common.RadioFeatures())
     self.mox.ReplayAll()
     mem = chirp_common.Memory()
     mem.power = src_rf.valid_power_levels[0]
     import_logic._import_power(radio, src_rf, mem)
     self.assertEqual(mem.power, None)
Example #5
0
 def test_import_power_closest(self):
     radio = FakeRadio(None)
     src_rf = chirp_common.RadioFeatures()
     src_rf.valid_power_levels = [
         chirp_common.PowerLevel('foo', watts=7),
         chirp_common.PowerLevel('bar', watts=51),
         chirp_common.PowerLevel('baz', watts=1),
         ]
     mem = chirp_common.Memory()
     mem.power = src_rf.valid_power_levels[0]
     import_logic._import_power(radio, src_rf, mem)
     self.assertEqual(mem.power, radio.POWER_LEVELS[0])