コード例 #1
0
 def testFailExcessAll(self):
     # Make sure error is raised for all holders exceeding
     # their group restriction
     fit = Fit()
     item = self.ch.type_(typeId=1, groupId=6, attributes={Attribute.maxGroupOnline: 1})
     holder1 = ShipItem(item)
     holder1.state = State.online
     fit.items.add(holder1)
     holder2 = ShipItem(item)
     holder2.state = State.online
     fit.items.add(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNotNone(restrictionError1)
     self.assertEqual(restrictionError1.maxGroup, 1)
     self.assertEqual(restrictionError1.holderGroup, 6)
     self.assertEqual(restrictionError1.groupHolders, 2)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNotNone(restrictionError2)
     self.assertEqual(restrictionError2.maxGroup, 1)
     self.assertEqual(restrictionError2.holderGroup, 6)
     self.assertEqual(restrictionError2.groupHolders, 2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertEqual(len(self.log), 0)
     self.assertRestrictionBuffersEmpty(fit)
コード例 #2
0
ファイル: testMaxGroupOnline.py プロジェクト: oneillkza/Eos
 def testPassHolderNoneGroup(self):
     # Check that holders with None group are not affected
     fit = Fit()
     item = self.ch.type_(typeId=1, groupId=None, attributes={Attribute.maxGroupOnline: 1})
     holder1 = ShipItem(item)
     holder1.state = State.online
     fit.items.append(holder1)
     holder2 = ShipItem(item)
     holder2.state = State.online
     fit.items.append(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError1)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertBuffersEmpty(fit)
コード例 #3
0
ファイル: testMaxGroupActive.py プロジェクト: oneillkza/Eos
 def testPassState(self):
     # No errors should occur if holders are not active+
     fit = Fit()
     item = self.ch.type_(typeId=1, groupId=886, attributes={Attribute.maxGroupActive: 1})
     holder1 = ShipItem(item)
     holder1.state = State.online
     fit.items.append(holder1)
     holder2 = ShipItem(item)
     holder2.state = State.online
     fit.items.append(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupActive)
     self.assertIsNone(restrictionError1)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupActive)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertBuffersEmpty(fit)
コード例 #4
0
ファイル: testMaxGroupOnline.py プロジェクト: oneillkza/Eos
 def testPass(self):
     # Make sure no errors are raised when number of added
     # items doesn't exceed any restrictions
     fit = Fit()
     item = self.ch.type_(typeId=1, groupId=860, attributes={Attribute.maxGroupOnline: 2})
     holder1 = ShipItem(item)
     holder1.state = State.online
     fit.items.append(holder1)
     holder2 = ShipItem(item)
     holder2.state = State.online
     fit.items.append(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError1)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertBuffersEmpty(fit)
コード例 #5
0
 def testPassHolderNoneGroup(self):
     # Check that holders with None group are not affected
     fit = Fit()
     item = self.ch.type_(typeId=1, groupId=None, attributes={Attribute.maxGroupOnline: 1})
     holder1 = ShipItem(item)
     holder1.state = State.online
     fit.items.add(holder1)
     holder2 = ShipItem(item)
     holder2.state = State.online
     fit.items.add(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError1)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertEqual(len(self.log), 0)
     self.assertRestrictionBuffersEmpty(fit)
コード例 #6
0
 def testPassState(self):
     # No errors should occur if holders are not active+
     fit = Fit()
     item = self.ch.type_(typeId=1, groupId=886, attributes={Attribute.maxGroupActive: 1})
     holder1 = ShipItem(item)
     holder1.state = State.online
     fit.items.add(holder1)
     holder2 = ShipItem(item)
     holder2.state = State.online
     fit.items.add(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupActive)
     self.assertIsNone(restrictionError1)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupActive)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertEqual(len(self.log), 0)
     self.assertRestrictionBuffersEmpty(fit)
コード例 #7
0
 def testPass(self):
     # Make sure no errors are raised when number of added
     # items doesn't exceed any restrictions
     fit = Fit()
     item = self.ch.type_(typeId=1, groupId=860, attributes={Attribute.maxGroupOnline: 2})
     holder1 = ShipItem(item)
     holder1.state = State.online
     fit.items.add(holder1)
     holder2 = ShipItem(item)
     holder2.state = State.online
     fit.items.add(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError1)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertEqual(len(self.log), 0)
     self.assertRestrictionBuffersEmpty(fit)
コード例 #8
0
ファイル: testMaxGroupOnline.py プロジェクト: oneillkza/Eos
 def testMixExcessOne(self):
     # Make sure error is raised for just holders which excess
     # restriction,even if they're from the same group
     fit = Fit()
     holder1 = ShipItem(self.ch.type_(typeId=1, groupId=92, attributes={Attribute.maxGroupOnline: 1}))
     holder1.state = State.online
     fit.items.append(holder1)
     holder2 = ShipItem(self.ch.type_(typeId=2, groupId=92, attributes={Attribute.maxGroupOnline: 2}))
     holder2.state = State.online
     fit.items.append(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNotNone(restrictionError1)
     self.assertEqual(restrictionError1.maxGroup, 1)
     self.assertEqual(restrictionError1.holderGroup, 92)
     self.assertEqual(restrictionError1.groupHolders, 2)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertBuffersEmpty(fit)
コード例 #9
0
ファイル: testMaxGroupOnline.py プロジェクト: oneillkza/Eos
 def testMixExcessOriginal(self):
     # Check that original item attributes are used
     fit = Fit()
     holder1 = ShipItem(self.ch.type_(typeId=1, groupId=61, attributes={Attribute.maxGroupOnline: 1}))
     holder1.attributes[Attribute.maxGroupOnline] = 2
     holder1.state = State.online
     fit.items.append(holder1)
     holder2 = ShipItem(self.ch.type_(typeId=2, groupId=61, attributes={Attribute.maxGroupOnline: 2}))
     holder2.attributes[Attribute.maxGroupOnline] = 1
     holder2.state = State.online
     fit.items.append(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNotNone(restrictionError1)
     self.assertEqual(restrictionError1.maxGroup, 1)
     self.assertEqual(restrictionError1.holderGroup, 61)
     self.assertEqual(restrictionError1.groupHolders, 2)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertBuffersEmpty(fit)
コード例 #10
0
 def testMixExcessOne(self):
     # Make sure error is raised for just holders which excess
     # restriction,even if they're from the same group
     fit = Fit()
     holder1 = ShipItem(self.ch.type_(typeId=1, groupId=92, attributes={Attribute.maxGroupOnline: 1}))
     holder1.state = State.online
     fit.items.add(holder1)
     holder2 = ShipItem(self.ch.type_(typeId=2, groupId=92, attributes={Attribute.maxGroupOnline: 2}))
     holder2.state = State.online
     fit.items.add(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNotNone(restrictionError1)
     self.assertEqual(restrictionError1.maxGroup, 1)
     self.assertEqual(restrictionError1.holderGroup, 92)
     self.assertEqual(restrictionError1.groupHolders, 2)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertEqual(len(self.log), 0)
     self.assertRestrictionBuffersEmpty(fit)
コード例 #11
0
 def testMixExcessOriginal(self):
     # Check that original item attributes are used
     fit = Fit()
     holder1 = ShipItem(self.ch.type_(typeId=1, groupId=61, attributes={Attribute.maxGroupOnline: 1}))
     holder1.attributes[Attribute.maxGroupOnline] = 2
     holder1.state = State.online
     fit.items.add(holder1)
     holder2 = ShipItem(self.ch.type_(typeId=2, groupId=61, attributes={Attribute.maxGroupOnline: 2}))
     holder2.attributes[Attribute.maxGroupOnline] = 1
     holder2.state = State.online
     fit.items.add(holder2)
     restrictionError1 = fit.getRestrictionError(holder1, Restriction.maxGroupOnline)
     self.assertIsNotNone(restrictionError1)
     self.assertEqual(restrictionError1.maxGroup, 1)
     self.assertEqual(restrictionError1.holderGroup, 61)
     self.assertEqual(restrictionError1.groupHolders, 2)
     restrictionError2 = fit.getRestrictionError(holder2, Restriction.maxGroupOnline)
     self.assertIsNone(restrictionError2)
     fit.items.remove(holder1)
     fit.items.remove(holder2)
     self.assertEqual(len(self.log), 0)
     self.assertRestrictionBuffersEmpty(fit)