Ejemplo n.º 1
0
    def test_print_gcode_should_send_email_when_complete_and_email_enabled(self, *args):
        self.setup_mocks(args)
        gcode_path = "FakeFile"
        config = self.default_config
        config.email.on = True
        api = PrintAPI(config)

        with patch('__builtin__.open', mock_open(read_data='bibble'), create=True):
            api.print_gcode(gcode_path)

        api.close()

        self.mock_EmailNotificationService.assert_called_with(self.mock_email_gateway, config.email.sender, config.email.recipient)
        self.mock_email_notification_service.send_message.assert_called_with("Print Complete", "%s is complete" % gcode_path)
Ejemplo n.º 2
0
    def test_print_gcode_should_send_email_when_complete_and_email_enabled(
            self, *args):
        self.setup_mocks(args)
        gcode_path = "FakeFile"
        config = self.default_config
        config.email.on = True
        api = PrintAPI(config)

        with patch('__builtin__.open',
                   mock_open(read_data='bibble'),
                   create=True):
            api.print_gcode(gcode_path)

        api.close()

        self.mock_EmailNotificationService.assert_called_with(
            self.mock_email_gateway, config.email.sender,
            config.email.recipient)
        self.mock_email_notification_service.send_message.assert_called_with(
            "Print Complete", "%s is complete" % gcode_path)
Ejemplo n.º 3
0
 def test_print_can_be_stopped_before_started(self, *args):
     api = PrintAPI(self.default_config)
     api.close()
Ejemplo n.º 4
0
 def test_print_can_be_stopped_before_started(self, *args):
     api = PrintAPI(self.default_config)
     api.close()