From 79f379a86836199cb5c2b46b04a4270c7979d971 Mon Sep 17 00:00:00 2001 From: Ross Hendrickson Date: Sun, 8 Sep 2013 19:49:26 -0500 Subject: [PATCH] Update tests and locations to reflect cura module move --- octoprint/slicers/cura/__init__.py | 7 ++++--- octoprint/slicers/cura/tests/test_cura.py | 7 +++---- octoprint/tests/test_file_manager.py | 11 ++++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/octoprint/slicers/cura/__init__.py b/octoprint/slicers/cura/__init__.py index 2d479b93..a91b2bae 100644 --- a/octoprint/slicers/cura/__init__.py +++ b/octoprint/slicers/cura/__init__.py @@ -14,14 +14,15 @@ class CuraFactory(object): :param path: :class: `str` """ if path: - return CuraEngine(path) + return Cura(path) + current_settings = settings(init=True) path = current_settings.get(["cura", "path"]) - return CuraEngine(path) + return Cura(path) -class CuraEngine(object): +class Cura(object): def __init__(self, cura_path): diff --git a/octoprint/slicers/cura/tests/test_cura.py b/octoprint/slicers/cura/tests/test_cura.py index 52cdf8f4..cd8a456b 100644 --- a/octoprint/slicers/cura/tests/test_cura.py +++ b/octoprint/slicers/cura/tests/test_cura.py @@ -3,8 +3,8 @@ import unittest from mock import patch -from octoprint.cura import CuraFactory -from octoprint.cura import CuraEngine +from octoprint.slicers.cura import CuraFactory +from octoprint.slicers.cura import Cura class CuraFactoryTestCase(unittest.TestCase): @@ -17,9 +17,8 @@ class CuraFactoryTestCase(unittest.TestCase): self.assertEqual(fake_path, result.cura_path) - @patch('octoprint.cura.parser.process_profile_ini') @patch('threading.Thread') - def test_cura_engine_process_file(self, thread, process): + def test_cura_engine_process_file(self, thread): path = 'rosshendrickson/workspaces/opensource/CuraEngine/' cura = CuraFactory.create_slicer(path) diff --git a/octoprint/tests/test_file_manager.py b/octoprint/tests/test_file_manager.py index 72663974..96ba7abf 100644 --- a/octoprint/tests/test_file_manager.py +++ b/octoprint/tests/test_file_manager.py @@ -4,6 +4,9 @@ from mock import patch import logging +from octoprint.filemanager.destinations import FileDestinations + + class FileManipulationTestCase(unittest.TestCase): def setUp(self): @@ -22,7 +25,7 @@ class FileManipulationTestCase(unittest.TestCase): logging.info("REMOVED %s filenames" % str(len(self.filenames))) - @patch('octoprint.cura.CuraEngine.process_file') + @patch('octoprint.slicers.cura.Cura.process_file') def test_add_stl_file(self, process): fake = Mock() @@ -30,12 +33,10 @@ class FileManipulationTestCase(unittest.TestCase): self.filenames.append(fake.filename) fake.__getitem__ = "SOMETHING" - result = self.manager.addFile(fake) + result = self.manager.addFile(fake, FileDestinations.LOCAL) logging.info("RESULT:%s" % str(result)) - self.assertIsNone(result) - self.assertTrue(process.called) def test_add_gcode_file(self): @@ -44,7 +45,7 @@ class FileManipulationTestCase(unittest.TestCase): self.filenames.append(fake.filename) fake.__getitem__ = "SOMETHING" - result = self.manager.addFile(fake) + result = self.manager.addFile(fake, FileDestinations.LOCAL) logging.info("RESULT:%s" % str(result))