コード例 #1
0
    def test_status_start_time_gives_start_time(self, mock_datetime):
        start_time = self.real_datetime(2012,1,1,8,0,0)
        mock_datetime.now.return_value = start_time

        status = MachineStatus()
        actual = status.status()['start_time']

        self.assertEqual(start_time,actual)
コード例 #2
0
    def test_status_start_time_gives_start_time(self, mock_datetime):
        start_time = self.real_datetime(2012,1,1,8,0,0)
        mock_datetime.now.return_value = start_time

        status = MachineStatus()
        actual = status.status()['start_time']

        self.assertEqual(start_time,actual)
コード例 #3
0
    def test_status_elapsed_time_gives_elapsed_time_in_seconds(self, mock_datetime):
        expected = self.real_timedelta(seconds = 10)
        values = [self.real_datetime(2012,1,1,8,0,0), self.real_datetime(2012,1,1,8,0,10)]
        def next_values():
            return values.pop(0)
        mock_datetime.now.side_effect = next_values

        status = MachineStatus()
        actual = status.status()['elapsed_time']

        self.assertEqual(expected,actual)
コード例 #4
0
    def test_status_elapsed_time_gives_elapsed_time_in_seconds(self, mock_datetime):
        expected = self.real_timedelta(seconds = 10)
        values = [self.real_datetime(2012,1,1,8,0,0), self.real_datetime(2012,1,1,8,0,10)]
        def next_values():
            return values.pop(0)
        mock_datetime.now.side_effect = next_values

        status = MachineStatus()
        actual = status.status()['elapsed_time']

        self.assertEqual(expected,actual)
コード例 #5
0
    def test_add_error_adds_an_error(self,mock_datetime):
        mock_time = self.real_datetime(2012,1,1,8,0,0)
        mock_datetime.now.return_value = mock_time
        message = "Message"
        expected = [{
        'layer' : None,
        'time': mock_time, 
        'message': message,
        }]

        status = MachineStatus()
        status.add_error(MachineError(message))

        self.assertEqual(expected,status.status()['errors'])
コード例 #6
0
    def test_add_error_adds_an_error(self,mock_datetime):
        mock_time = self.real_datetime(2012,1,1,8,0,0)
        mock_datetime.now.return_value = mock_time
        message = "Message"
        expected = [{
        'layer' : None,
        'time': mock_time, 
        'message': message,
        }]

        status = MachineStatus()
        status.add_error(MachineError(message))

        self.assertEqual(expected,status.status()['errors'])
コード例 #7
0
 def test_status_is_running_after_first_drip(self):
     status = MachineStatus()
     status.drip_call_back(1,1)
     self.assertEqual('Running',status.status()['status'])
コード例 #8
0
 def test_status_is_starting_before_first_drip(self):
     status = MachineStatus()
     self.assertEqual('Starting',status.status()['status'])
コード例 #9
0
    def test_skipped_layer_adds_a_skipped_layer(self):
        status = MachineStatus()
        status.skipped_layer()

        self.assertEqual(1,status.status()['skipped_layers'])
コード例 #10
0
 def test_status_is_running_after_first_drip(self):
     status = MachineStatus()
     status.drip_call_back(1,1,1)
     self.assertEqual('Running',status.status()['status'])
コード例 #11
0
    def test_set_model_height_update_height_of_layer(self):
        status = MachineStatus()
        status.set_model_height(7.12213)

        self.assertEqual(7.12213,status.status()['model_height'])
コード例 #12
0
 def test_once_complete_drips_or_layers_dont_change_status(self):
     status = MachineStatus()
     status.set_complete()
     status.add_layer()
     status.drip_call_back(45,10)
     self.assertEqual('Complete',status.status()['status'])
コード例 #13
0
    def test_not_waiting_for_drips_sets_waiting(self):
        status = MachineStatus()
        status.set_not_waiting_for_drips()

        self.assertEqual(False,status.status()['waiting_for_drips'])
コード例 #14
0
    def test_add_error_adds_an_error(self):
        status = MachineStatus()
        status.add_error(MachineError("Error", "Test Error"))

        self.assertEqual(1,status.status()['errors'])
コード例 #15
0
    def test_set_model_height_update_height_of_layer(self):
        status = MachineStatus()
        status.set_model_height(7.12213)

        self.assertEqual(7.12213,status.status()['model_height'])
コード例 #16
0
 def test_once_complete_drips_or_layers_dont_change_status(self):
     status = MachineStatus()
     status.set_complete()
     status.add_layer()
     status.drip_call_back(45,10,12)
     self.assertEqual('Complete',status.status()['status'])
コード例 #17
0
 def test_set_complete_makes_status_complete(self):
     status = MachineStatus()
     status.set_complete()
     self.assertEqual('Complete',status.status()['status'])
コード例 #18
0
 def test_status_is_running_after_first_layer(self):
     status = MachineStatus()
     status.add_layer()
     self.assertEqual('Running',status.status()['status'])
コード例 #19
0
 def test_status_is_running_after_first_layer(self):
     status = MachineStatus()
     status.add_layer()
     self.assertEqual('Running',status.status()['status'])
コード例 #20
0
 def test_drip_call_back_updates_height(self):
     status = MachineStatus()
     status.drip_call_back(67,12,12.2)
     self.assertEqual(12, status.status()['height'])
     self.assertEqual(67, status.status()['drips'])
     self.assertEqual(12.2, status.status()['drips_per_second'])
コード例 #21
0
 def test_set_complete_makes_status_complete(self):
     status = MachineStatus()
     status.set_complete()
     self.assertEqual('Complete',status.status()['status'])
コード例 #22
0
    def test_skipped_layer_adds_a_skipped_layer(self):
        status = MachineStatus()
        status.skipped_layer()

        self.assertEqual(1,status.status()['skipped_layers'])
コード例 #23
0
    def test_add_error_adds_an_error(self):
        status = MachineStatus()
        status.add_error(MachineError("Error", "Test Error"))

        self.assertEqual(1,status.status()['errors'])
コード例 #24
0
    def test_add_layer_adds_a_layer(self):
        status = MachineStatus()
        status.add_layer()

        self.assertEqual(1,status.status()['current_layer'])
コード例 #25
0
    def test_not_waiting_for_drips_sets_waiting(self):
        status = MachineStatus()
        status.set_not_waiting_for_drips()

        self.assertEqual(False,status.status()['waiting_for_drips'])
コード例 #26
0
    def test_add_layer_adds_a_layer(self):
        status = MachineStatus()
        status.add_layer()

        self.assertEqual(1,status.status()['current_layer'])
コード例 #27
0
 def test_drip_call_back_updates_height(self):
     status = MachineStatus()
     status.drip_call_back(67,12)
     self.assertEqual(12, status.status()['height'])
     self.assertEqual(67, status.status()['drips'])
コード例 #28
0
 def test_status_is_starting_before_first_drip(self):
     status = MachineStatus()
     self.assertEqual('Starting',status.status()['status'])