Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created July 8, 2020 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosble/c6e648a6e3419fe568b4f6c6d8b29e06 to your computer and use it in GitHub Desktop.
Save carlosble/c6e648a6e3419fe568b4f6c6d8b29e06 to your computer and use it in GitHub Desktop.
import unittest
from camera import Controller, Sensor, Recorder
class CameraTests(unittest.TestCase):
def test_asks_the_recorder_to_stop_recording_when_no_information_received_from_sensor(self):
sensor = Sensor() # mocks
recorder = Recorder() # mocks
self.called = False
def save_call():
self.called = True
sensor.is_detecting_movement = lambda: False
recorder.stop_recording = save_call
controller = Controller(sensor, recorder)
controller.record_movement()
self.assertTrue(self.called)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment