コード例 #1
0
 def test_filter_system_ly(self):
     nearby = tb_Filter_systems(30002871, 1)
     nearby.max = 7.0
     jita = tb_Filter_systems(30000142, 1)
     jita.max = 10.0
     jan = tb_Filter_systems(30001385, 1)
     jan.max = 10.0
     self.db.merge(nearby)
     self.db.merge(jita)
     self.db.merge(jan)
     self.db.commit()
     tb_systems.api_mass_data_resolve(self.service)
     self.km = tb_kills.get_row(self.data.get("package"), self.service)
     nearby = tb_Filter_systems.get_row(1, 30002871, self.service)
     jita = tb_Filter_systems.get_row(1, 30000142, self.service)
     jan = tb_Filter_systems.get_row(1, 30001385, self.service)
     f_contains = [nearby, jita]
     f_missing = [jita, jan]
     with self.subTest("blacklist"):
         self.assertEqual(
             None, self.km.filter_system_ly(f_contains,
                                            using_blacklist=True))
         self.assertEqual(
             self.km.object_system,
             self.km.filter_system_ly(f_missing, using_blacklist=True))
     with self.subTest("whitelist"):
         self.assertEqual(
             nearby.object_item,
             self.km.filter_system_ly(f_contains, using_blacklist=False))
         self.assertEqual(
             None, self.km.filter_system_ly(f_missing,
                                            using_blacklist=False))
コード例 #2
0
 def setUp(self):
     super().setUp()
     self.service = ServiceModule.ServiceModule(self.db)
     self.set_resource_path('db_tables', 'eve', 'mails')
     self.data = self.file_json("74647898.json")
     tb_kills.make_row(self.data.get("package"), self.service)
     self.km: tb_kills = tb_kills.get_row(self.data.get("package"),
                                          self.service)
コード例 #3
0
 def test_get_alive_nonnpc_count(self):
     for group_id in [1305, 833, 831, 893, 1527, 25, 1534]:
         self.db.add(tb_groups(group_id))
     self.db.commit()
     tb_groups.api_mass_data_resolve(self.service)
     self.km = tb_kills.get_row(self.data.get("package"), self.service)
     self.assertEqual(
         27, self.km.get_alive_nonnpc_count(self.km.object_attackers))
コード例 #4
0
 def test_str_ly_range(self):
     self.db.add(tb_systems(30000142))
     self.db.commit()
     tb_systems.api_mass_data_resolve(self.service)
     updated_km = tb_kills.get_row(self.data.get("package"), self.service)
     updated_system = tb_systems.get_row(30000142, self.service)
     self.assertEqual("27.6", updated_km.str_ly_range(updated_system))
     self.assertEqual("0.0",
                      updated_km.str_ly_range(updated_km.object_system))
コード例 #5
0
 def test_filter_loss_groups(self):
     self.db.add(tb_groups(833))
     self.db.add(tb_groups(831))
     self.db.commit()
     tb_groups.api_mass_data_resolve(self.service)
     self.km = tb_kills.get_row(self.data.get("package"), self.service)
     f_contains = [tb_Filter_groups(i, 1, False) for i in [833, 831]]
     f_missing = [tb_Filter_groups(i, 1, False) for i in [831, 10830]]
     self.helper_filter_loss(f_contains, f_missing)
コード例 #6
0
 def test_get_au_location_distance(self):
     loc_nearest = tb_locations(40181682)
     loc_nearest.pos_x = -268292939299
     loc_nearest.pos_y = -31101911311
     loc_nearest.pos_z = 361046068690
     self.db.merge(loc_nearest)
     self.db.commit()
     self.km = tb_kills.get_row(self.data.get("package"), self.service)
     self.assertEqual(7.86165310033881e-05,
                      self.km.get_au_location_distance())
コード例 #7
0
 def test_filter_system_region(self):
     self.db.merge(tb_Filter_regions(10000034, 1))
     self.db.merge(tb_Filter_regions(10000002, 1))
     self.db.commit()
     tb_regions.api_mass_data_resolve(self.service)
     tb_constellations.api_mass_data_resolve(self.service)
     self.km = tb_kills.get_row(self.data.get("package"), self.service)
     f_contains = [tb_Filter_regions.get_row(1, 10000034, self.service)]
     f_missing = [tb_Filter_regions.get_row(1, 10000002, self.service)]
     self.helper_filter_system(f_contains, f_missing)
コード例 #8
0
 def test_load_fk_objects(self):
     self.tearDown()
     super().setUp()
     self.set_resource_path('db_tables', 'eve', 'mails')
     data = self.file_json("74647898.json")
     row = tb_kills(data.get("package"))
     row.load_fk_objects()
     self.db.merge(row)
     self.db.commit()
     row = tb_kills.get_row(data.get("package"), self.service)
     self.assertIsInstance(row.object_system, tb_systems)
     self.assertIsInstance(row.object_location, tb_locations)
     self.assertIsInstance(row.object_victim, tb_victims)
     self.assertIsInstance(row.object_attackers, list)
     self.assertEqual(27, len(row.object_attackers))
コード例 #9
0
 def test_str_location_name(self):
     loc_nearest = tb_locations(40181682)
     loc_nearest.name = "9-0QB7 IV"
     loc_nearest.pos_x = -268292939299
     loc_nearest.pos_y = -31101911311
     loc_nearest.pos_z = 361046068690
     self.db.merge(loc_nearest)
     self.db.commit()
     self.km = tb_kills.get_row(self.data.get("package"), self.service)
     with self.subTest("name_only=True, on grid"):
         self.assertEqual("9-0QB7 IV",
                          self.km.str_location_name(name_only=True))
     with self.subTest("name_only=False, on grid"):
         self.assertEqual(" near **9-0QB7 IV**.",
                          self.km.str_location_name(name_only=False))
     self.km.object_victim.pos_x += 500000000000
     with self.subTest("name_only=True, off grid"):
         self.assertEqual("9-0QB7 IV (3.3 AU)",
                          self.km.str_location_name(name_only=True))
     with self.subTest("name_only=False, off grid"):
         self.assertEqual(" near **9-0QB7 IV (3.3 AU)**.",
                          self.km.str_location_name(name_only=False))
コード例 #10
0
 def test_get_row(self):
     self.assertIsInstance(
         tb_kills.get_row(self.data.get("package"), self.service), tb_kills)