示例#1
0
    def test_spotReceived_newCall_shouldAddSpot(self):
        now = time.time()
        spot_call1 = _callinfo.Call("AA1BB")
        spot_call2 = _callinfo.Call("AA2BB")
        aggregator = _spotting.SpotAggregator(FakeDXCC())
        incoming_spot1 = _spotting.Spot(60, spot_call1, 14070000, now - 1,
            _callinfo.Call("CT1XY"), _grid.Locator("JN12aa"))
        incoming_spot2 = _spotting.Spot(60, spot_call2, 7040000, now,
            _callinfo.Call("CT2XY"), _grid.Locator("JN12aa"))
        aggregator.spot_received(incoming_spot1)
        aggregator.spot_received(incoming_spot2)

        self.assertEqual(len(aggregator.spots[spot_call1]), 1)
        self.assertEqual(len(aggregator.spots[spot_call2]), 1)

        spot1 = aggregator.spots[spot_call1][0]
        self.assertEqual(len(spot1.sources), 1)
        for source in spot1.sources:
            self.assertEqual(source.source_dxcc_info, "FakeDXCCInfo")
        self.assertEqual(spot1.frequency, 14070000)
        self.assertEqual(spot1.timeout, now - 1 + 60)
        self.assertEqual(spot1.first_seen, now - 1)
        self.assertEqual(spot1.last_seen, now - 1)

        spot2 = aggregator.spots[spot_call2][0]
        self.assertEqual(len(spot2.sources), 1)
        for source in spot2.sources:
            self.assertEqual(source.source_dxcc_info, "FakeDXCCInfo")
        self.assertEqual(spot2.frequency, 7040000)
        self.assertEqual(spot2.timeout, now + 60)
        self.assertEqual(spot2.first_seen, now)
        self.assertEqual(spot2.last_seen, now)
示例#2
0
    def test_updateSpots_shouldKeepActiveSpots(self):
        now = time.time()
        spot_call = _callinfo.Call("AA1BB")
        aggregator = _spotting.SpotAggregator(FakeDXCC())
        incoming_spot = _spotting.Spot(60, spot_call, 14070000, now - 1,
            _callinfo.Call("CT1XY"), _grid.Locator("JN12aa"))
        aggregator.spot_received(incoming_spot)
        self.assertEqual(len(aggregator.spots), 1)

        aggregator.cleanup_spots()
        self.assertEqual(len(aggregator.spots), 1)
示例#3
0
    def test_twoCalls_oneDifference_shouldAggregateToOneSpotUsingMajorityWhenChoosingFile(self):
        now = time.time()
        spot_call1 = _callinfo.Call("AA1BB")
        spot_call2 = _callinfo.Call("AA2BB")
        aggregator = _spotting.SpotAggregator(FakeDXCC())
        incoming_spot1 = _spotting.Spot(60, spot_call1, 7040000, now,
            _callinfo.Call("CT1XY"), _grid.Locator("JN12aa"))
        incoming_spot2 = _spotting.Spot(60, spot_call2, 7040000, now,
            _callinfo.Call("CT2XY"), _grid.Locator("JN12aa"))
        incoming_spot3 = _spotting.Spot(60, spot_call2, 7040000, now,
            _callinfo.Call("CT3XY"), _grid.Locator("JN12aa"))
        aggregator.spot_received(incoming_spot1)
        aggregator.spot_received(incoming_spot2)
        aggregator.spot_received(incoming_spot3)
        aggregator.cleanup_spots()

        self.assertEqual(len(aggregator.spots), 1)
        self.assertFalse(spot_call1 in aggregator.spots)
        self.assertTrue(spot_call2 in aggregator.spots)
示例#4
0
    def test_spotReceived_callExists_sameFrequency_shouldAddSource(self):
        now = time.time()
        spot_call = _callinfo.Call("AA1BB")
        aggregator = _spotting.SpotAggregator(FakeDXCC())
        incoming_spot1 = _spotting.Spot(60, spot_call, 14070000, now - 1,
            _callinfo.Call("CT1XY"), _grid.Locator("JN12aa"))
        incoming_spot2 = _spotting.Spot(60, spot_call, 14070000, now,
            _callinfo.Call("CT2XY"), _grid.Locator("JN12aa"))
        aggregator.spot_received(incoming_spot1)
        aggregator.spot_received(incoming_spot2)

        self.assertEqual(len(aggregator.spots[spot_call]), 1)
        spot = aggregator.spots[spot_call][0]
        self.assertEqual(len(spot.sources), 2)

        for source in spot.sources:
            self.assertEqual(source.source_dxcc_info, "FakeDXCCInfo")
        self.assertEqual(spot.frequency, 14070000)
        self.assertEqual(spot.timeout, now + 60)
        self.assertEqual(spot.first_seen, now - 1)
        self.assertEqual(spot.last_seen, now)
示例#5
0
文件: test.py 项目: ftl/dxpad
 def test_base_call_with_prefix_and_suffix_and_working_condition(self):
     self.assertCall(_callinfo.Call("WB3/DL3NEY/8/p"), "WB3", "DL3NEY", "8",
                     "P")
示例#6
0
文件: test.py 项目: ftl/dxpad
 def test_base_call_with_prefix_and_working_condition(self):
     self.assertCall(_callinfo.Call("EA8/DL3NEY/MM"), "EA8", "DL3NEY", None,
                     "MM")
示例#7
0
文件: test.py 项目: ftl/dxpad
 def test_base_call_with_prefix_and_suffix(self):
     self.assertCall(_callinfo.Call("WB3/DL3NEY/8"), "WB3", "DL3NEY", "8",
                     None)
示例#8
0
文件: test.py 项目: ftl/dxpad
 def test_base_call_with_suffix_and_working_condition(self):
     self.assertCall(_callinfo.Call("DL3NEY/KP4/MM"), None, "DL3NEY", "KP4",
                     "MM")
示例#9
0
文件: test.py 项目: ftl/dxpad
 def test_base_call_with_suffix(self):
     self.assertCall(_callinfo.Call("DL3NEY/KP4"), None, "DL3NEY", "KP4",
                     None)
示例#10
0
文件: test.py 项目: ftl/dxpad
 def test_base_call_with_working_condition(self):
     self.assertCall(_callinfo.Call("DL3NEY/p"), None, "DL3NEY", None, "P")
示例#11
0
文件: test.py 项目: ftl/dxpad
 def test_base_call_with_prefix(self):
     self.assertCall(_callinfo.Call("EA6/DL3NEY"), "EA6", "DL3NEY", None,
                     None)
示例#12
0
文件: test.py 项目: ftl/dxpad
 def test_base_call(self):
     self.assertCall(_callinfo.Call("DL3NEY"), None, "DL3NEY", None, None)