Пример #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)