def _GetRecoverables(reprocessingSvc, item, stationsTake, portions, efficiency): recoverables = [] if invconst.typeCredits != item.typeID and portions: materials = reprocessingSvc.inventorymgr.GetMaterialComposition(item.typeID) if materials and len(materials): for material in materials: try: quantity = material.quantity * portions recoverable = int(floor(quantity * efficiency)) client = recoverable station = recoverable * stationsTake price = GetAdjustedAveragePrice(material.materialTypeID) if price is None: price = 0 iskCost = round(price * station, 2) except OverflowError: raise UserError('ReprocessingPleaseSplit') unrecoverable = int(round(quantity - client)) recoverables.append(Bundle(typeID=material.materialTypeID, client=client, unrecoverable=unrecoverable, iskCost=iskCost)) return recoverables
def __getattr__(self, item): try: return Bundle.__getattr__(self, item) except (KeyError, AttributeError): return None
def GetSubscriptionEndTime(self): return Bundle(subscriptionEndTime=self.userDetails.subscriptionEndTime, trainingEndTimes=self.trainingDetails)
def GetJumpCloneDetails(): clonejump = sm.GetService('clonejump') cloneID, cloneName = clonejump.GetCloneAtLocation(session.stationid2) implants = clonejump.GetImplantsForClone(cloneID) clone = Bundle(id=cloneID, name=cloneName, implants=implants) return clone
def _IsOk(self, moduleIDs): with SettingsMock(): dogmaLocation = Bundle(GetModulesLackingSkills=lambda: moduleIDs) isOk = IsOkToBoardWithModulesLackingSkills(dogmaLocation, self.message) return isOk
#Embedded file name: e:\jenkins\workspace\client_SERENITY\branches\release\SERENITY\eve\client\script\ui\station\test\test_isOkToBoardWithModulesLackingSkills.py from unittest import TestCase import mock from itertoolsext import Bundle carbonui = mock.Mock() ID_YES = 100 YESNO = 1000 with mock.patch.dict('sys.modules', { 'carbonui': carbonui, 'carbonui.const': Bundle(ID_YES=ID_YES, YESNO=YESNO) }): from eve.client.script.ui.station.askForUndock import IsOkToBoardWithModulesLackingSkills import carbonui.const as uiconst from testhelpers.evemocks import SettingsMock class TestIsOkToBoardWithModulesLackingSkills(TestCase): def setUp(self): self._SetMessage(mock.Mock(return_value=uiconst.ID_YES)) def _SetMessage(self, mockObject): self.message = mockObject def testWhenMessageIsSuppressedWeReturnTrue(self): with SettingsMock(): settings.user.suppress.Set( 'suppress.AskUndockWithModulesLackingSkill', True) self.assertTrue( IsOkToBoardWithModulesLackingSkills(None, self.message)) def testWhenDogmaGivesYouNoModulesYouDoNotHaveSkillsForWeReturnTrue(self):
def AddEffect(self, effectID, typeID, effectCategory): effect = Bundle(effectCategory=effectCategory) self.dogmaStaticMgr.effects[effectID] = effect self.effectsByType[typeID][effectID] = effect
def _GetInventory2(self): return Bundle(IsPrimed=lambda itemID: itemID in self.dogmaItems, GetItem=lambda itemID: self.GetItem(itemID))
def AddStructure(self, typeID, groupID=1001): itemID = super(MockServerDogmaLocation, self).AddStructure(typeID, groupID=groupID) self.__balls[itemID] = Bundle() return itemID
def AddShip(self, typeID, ownerID, groupID=1000): itemID = super(MockServerDogmaLocation, self).AddShip(typeID, ownerID, groupID=groupID) self.__balls[itemID] = Bundle(structures=[]) return itemID
def _GetDogmaMsgMngr(self): return Bundle(AddAttribute=lambda x: x)
def _GetEnvironmentInfo(self, itemID): item = self.dogmaItems[itemID] return Bundle(charID=item.ownerID, itemID=item.itemID, shipID=item.locationID, otherID=None)
def _GetDogmaStaticMgr(self): return Bundle(effects={}, crystalModuleGroupIDs={}, effectsByType=self.effectsByType, GetTypeAttribute2=lambda typeID, attributeID: self. typeAttributes[typeID].get(attributeID, 0))