Implement item cachine for 26.3
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import unittest
|
||||
|
||||
from munch import Munch
|
||||
|
||||
from mosfet.info import items
|
||||
from mosfet.job import JobStates
|
||||
|
||||
|
||||
class TestCropCaching(unittest.TestCase):
|
||||
def test_crop_farm_runs_silent_cache_machine_and_keeps_seeds(self):
|
||||
old_wanted = items.WANTED_ITEMS
|
||||
crop_state = object()
|
||||
cache_state = Munch(silent=False)
|
||||
jobs = JobStates.__new__(JobStates)
|
||||
jobs.gather_crop_states = crop_state
|
||||
jobs.cache_items_states = cache_state
|
||||
|
||||
try:
|
||||
machines = JobStates.farm_crop(jobs)
|
||||
self.assertEqual(machines, [crop_state, cache_state])
|
||||
self.assertTrue(cache_state.silent)
|
||||
self.assertTrue({
|
||||
items.CARROT_ID, items.POTATO_ID,
|
||||
items.WHEAT_SEEDS_ID, items.BEETROOT_SEEDS_ID,
|
||||
}.issubset(items.WANTED_ITEMS))
|
||||
finally:
|
||||
items.WANTED_ITEMS = old_wanted
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user