Files
minecraft-bot/tests/test_crop_cache.py
T

32 lines
942 B
Python

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()