Exemplo n.º 1
0
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
Exemplo n.º 3
0
 def GetSubscriptionEndTime(self):
     return Bundle(subscriptionEndTime=self.userDetails.subscriptionEndTime,
                   trainingEndTimes=self.trainingDetails)
Exemplo n.º 4
0
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):
Exemplo n.º 7
0
 def AddEffect(self, effectID, typeID, effectCategory):
     effect = Bundle(effectCategory=effectCategory)
     self.dogmaStaticMgr.effects[effectID] = effect
     self.effectsByType[typeID][effectID] = effect
Exemplo n.º 8
0
 def _GetInventory2(self):
     return Bundle(IsPrimed=lambda itemID: itemID in self.dogmaItems,
                   GetItem=lambda itemID: self.GetItem(itemID))
Exemplo n.º 9
0
 def AddStructure(self, typeID, groupID=1001):
     itemID = super(MockServerDogmaLocation,
                    self).AddStructure(typeID, groupID=groupID)
     self.__balls[itemID] = Bundle()
     return itemID
Exemplo n.º 10
0
 def AddShip(self, typeID, ownerID, groupID=1000):
     itemID = super(MockServerDogmaLocation, self).AddShip(typeID,
                                                           ownerID,
                                                           groupID=groupID)
     self.__balls[itemID] = Bundle(structures=[])
     return itemID
Exemplo n.º 11
0
 def _GetDogmaMsgMngr(self):
     return Bundle(AddAttribute=lambda x: x)
Exemplo n.º 12
0
 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))