コード例 #1
0
 def test_fail(self):
     # Check that if 2 or more holders are put into single slot
     # index, error is raised
     item = self.ch.type_(type_id=1,
                          attributes={Attribute.implantness: 120})
     holder1 = Mock(state=State.offline,
                    item=item,
                    _domain=Domain.character,
                    spec_set=Implant(1))
     holder2 = Mock(state=State.offline,
                    item=item,
                    _domain=Domain.character,
                    spec_set=Implant(1))
     self.track_holder(holder1)
     self.track_holder(holder2)
     restriction_error1 = self.get_restriction_error(
         holder1, Restriction.implant_index)
     self.assertIsNotNone(restriction_error1)
     self.assertEqual(restriction_error1.holder_slot_index, 120)
     restriction_error2 = self.get_restriction_error(
         holder2, Restriction.implant_index)
     self.assertIsNotNone(restriction_error2)
     self.assertEqual(restriction_error2.holder_slot_index, 120)
     self.untrack_holder(holder1)
     self.untrack_holder(holder2)
     self.assertEqual(len(self.log), 0)
     self.assert_restriction_buffers_empty()
コード例 #2
0
 def test_fail_original(self):
     # Make sure that original attributes are used
     item = self.ch.type_(type_id=1,
                          attributes={Attribute.implantness: 120})
     holder1 = Mock(state=State.offline,
                    item=item,
                    _domain=Domain.character,
                    spec_set=Implant(1))
     holder2 = Mock(state=State.offline,
                    item=item,
                    _domain=Domain.character,
                    spec_set=Implant(1))
     holder1.attributes = {Attribute.implantness: 119}
     holder2.attributes = {Attribute.implantness: 121}
     self.track_holder(holder1)
     self.track_holder(holder2)
     restriction_error1 = self.get_restriction_error(
         holder1, Restriction.implant_index)
     self.assertIsNotNone(restriction_error1)
     self.assertEqual(restriction_error1.holder_slot_index, 120)
     restriction_error2 = self.get_restriction_error(
         holder2, Restriction.implant_index)
     self.assertIsNotNone(restriction_error2)
     self.assertEqual(restriction_error2.holder_slot_index, 120)
     self.untrack_holder(holder1)
     self.untrack_holder(holder2)
     self.assertEqual(len(self.log), 0)
     self.assert_restriction_buffers_empty()
コード例 #3
0
 def test_pass_different(self):
     # Holders taking different slots shouldn't trigger any errors
     item1 = self.ch.type_(type_id=1,
                           attributes={Attribute.implantness: 120})
     item2 = self.ch.type_(type_id=2,
                           attributes={Attribute.implantness: 121})
     holder1 = Mock(state=State.offline,
                    item=item1,
                    _domain=Domain.character,
                    spec_set=Implant(1))
     holder2 = Mock(state=State.offline,
                    item=item2,
                    _domain=Domain.character,
                    spec_set=Implant(1))
     self.track_holder(holder1)
     self.track_holder(holder2)
     restriction_error1 = self.get_restriction_error(
         holder1, Restriction.implant_index)
     self.assertIsNone(restriction_error1)
     restriction_error2 = self.get_restriction_error(
         holder2, Restriction.implant_index)
     self.assertIsNone(restriction_error2)
     self.untrack_holder(holder1)
     self.untrack_holder(holder2)
     self.assertEqual(len(self.log), 0)
     self.assert_restriction_buffers_empty()
コード例 #4
0
 def test_use_other_class(self):
     item = self.ch.type_(type_id=1, attributes={})
     holder = Mock(state=State.online,
                   item=item,
                   _domain=Domain.space,
                   spec_set=Implant(1))
     self.track_holder(holder)
     self.assertEqual(self.st.launched_drones.used, 0)
     self.untrack_holder(holder)
     self.assertEqual(len(self.log), 0)
     self.assert_stat_buffers_empty()
コード例 #5
0
 def test_pass_other_class(self):
     item = self.ch.type_(type_id=1)
     holder = Mock(state=State.online, item=item, _domain=Domain.space, spec_set=Implant(1))
     self.track_holder(holder)
     self.fit.stats.launched_drones.used = 1
     self.fit.stats.launched_drones.total = 0
     restriction_error = self.get_restriction_error(holder, Restriction.launched_drone)
     self.assertIsNone(restriction_error)
     self.untrack_holder(holder)
     self.assertEqual(len(self.log), 0)
     self.assert_restriction_buffers_empty()
コード例 #6
0
 def test_pass(self):
     # Single holder which takes some slot shouldn't
     # trigger any errors
     item = self.ch.type_(type_id=1,
                          attributes={Attribute.implantness: 120})
     holder = Mock(state=State.offline,
                   item=item,
                   _domain=Domain.character,
                   spec_set=Implant(1))
     self.track_holder(holder)
     restriction_error = self.get_restriction_error(
         holder, Restriction.implant_index)
     self.assertIsNone(restriction_error)
     self.untrack_holder(holder)
     self.assertEqual(len(self.log), 0)
     self.assert_restriction_buffers_empty()
コード例 #7
0
 def test_fail_excess_signle_other_class_domain(self):
     # Make sure holders of all classes are affected
     item = self.ch.type_(type_id=1)
     holder = Mock(state=State.offline,
                   item=item,
                   _domain=Domain.character,
                   spec_set=Implant(1))
     self.fit.modules.low.append(holder)
     self.fit.stats.low_slots.used = 1
     self.fit.stats.low_slots.total = 0
     restriction_error = self.get_restriction_error(holder,
                                                    Restriction.low_slot)
     self.assertIsNotNone(restriction_error)
     self.assertEqual(restriction_error.slots_max_allowed, 0)
     self.assertEqual(restriction_error.slots_used, 1)
     self.assertEqual(len(self.log), 0)
     self.assert_restriction_buffers_empty()
コード例 #8
0
ファイル: test_calibration.py プロジェクト: Ebag333/eos
 def test_use_other_class_domain(self):
     item = self.ch.type_(type_id=1, attributes={Attribute.upgrade_cost: 0})
     holder1 = Mock(state=State.offline,
                    item=item,
                    _domain=Domain.ship,
                    spec_set=Module(1))
     holder1.attributes = {Attribute.upgrade_cost: 50}
     self.track_holder(holder1)
     holder2 = Mock(state=State.offline,
                    item=item,
                    _domain=Domain.character,
                    spec_set=Implant(1))
     holder2.attributes = {Attribute.upgrade_cost: 30}
     self.track_holder(holder2)
     self.assertEqual(self.st.calibration.used, 80)
     self.untrack_holder(holder1)
     self.untrack_holder(holder2)
     self.assertEqual(len(self.log), 0)
     self.assert_stat_buffers_empty()
コード例 #9
0
ファイル: test_cpu.py プロジェクト: gitter-badger/eos-1
 def test_fail_excess_single_other_class_domain(self):
     # Make sure holders of all classes are affected
     item = self.ch.type_(type_id=1, attributes={Attribute.cpu: 0})
     holder = Mock(state=State.online,
                   item=item,
                   _domain=Domain.character,
                   spec_set=Implant(1))
     holder.attributes = {Attribute.cpu: 50}
     self.track_holder(holder)
     self.fit.stats.cpu.used = 50
     self.fit.stats.cpu.output = 40
     restriction_error = self.get_restriction_error(holder, Restriction.cpu)
     self.assertIsNotNone(restriction_error)
     self.assertEqual(restriction_error.output, 40)
     self.assertEqual(restriction_error.total_use, 50)
     self.assertEqual(restriction_error.holder_use, 50)
     self.untrack_holder(holder)
     self.assertEqual(len(self.log), 0)
     self.assert_restriction_buffers_empty()
コード例 #10
0
 def test_use_other_class_domain(self):
     item = self.ch.type_(type_id=1,
                          attributes={Attribute.drone_bandwidth_used: 0})
     holder1 = Mock(state=State.online,
                    item=item,
                    _domain=Domain.space,
                    spec_set=Drone(1))
     holder1.attributes = {Attribute.drone_bandwidth_used: 50}
     self.track_holder(holder1)
     holder2 = Mock(state=State.online,
                    item=item,
                    _domain=Domain.character,
                    spec_set=Implant(1))
     holder2.attributes = {Attribute.drone_bandwidth_used: 30}
     self.track_holder(holder2)
     self.assertEqual(self.st.drone_bandwidth.used, 80)
     self.untrack_holder(holder1)
     self.untrack_holder(holder2)
     self.assertEqual(len(self.log), 0)
     self.assert_stat_buffers_empty()
コード例 #11
0
ファイル: test_drone_group.py プロジェクト: Ebag333/eos
 def test_pass_non_drone(self):
     # Check that restriction is not applied
     # to holders which are not drones
     item = self.ch.type_(type_id=1, group=56)
     holder = Mock(state=State.offline,
                   item=item,
                   _domain=Domain.character,
                   spec_set=Implant(1))
     self.track_holder(holder)
     ship_item = self.ch.type_(
         type_id=2, attributes={Attribute.allowed_drone_group_1: 4})
     ship_holder = Mock(state=State.offline,
                        item=ship_item,
                        _domain=None,
                        spec_set=Ship(1))
     self.set_ship(ship_holder)
     restriction_error = self.get_restriction_error(holder,
                                                    Restriction.drone_group)
     self.assertIsNone(restriction_error)
     self.untrack_holder(holder)
     self.set_ship(None)
     self.assertEqual(len(self.log), 0)
     self.assert_restriction_buffers_empty()