Created
July 8, 2020 16:04
-
-
Save carlosble/c6e648a6e3419fe568b4f6c6d8b29e06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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