def testBasedirCreated(self): """ test creating new base directory with _makeBaseDir() """ self.patch(os.path, "exists", mock.Mock(return_value=False)) # call _makeBaseDir() create_slave._makeBaseDir("dummy", False) # check that os.mkdir() was called with correct path self.mkdir.assert_called_once_with("dummy") # check that correct message was printed to stdout self.assertStdoutEqual("mkdir dummy\n")
def testBasedirCreated(self): """ test creating new base directory with _makeBaseDir() """ self.patch(os.path, "exists", mock.Mock(return_value=False)) # call _makeBaseDir() create_slave._makeBaseDir("dummy", False) # check that os.mkdir() was called with correct path self.mkdir.assert_called_once_with("dummy") # check that correct message was printed to the log self.assertLogged("mkdir dummy")
def testBasedirExists(self): """ test calling _makeBaseDir() on existing base directory """ self.patch(os.path, "exists", mock.Mock(return_value=True)) # call _makeBaseDir() create_slave._makeBaseDir("dummy", False) # check that correct message was printed to stdout self.assertStdoutEqual("updating existing installation\n") # check that os.mkdir was not called self.assertFalse(self.mkdir.called, "unexpected call to os.mkdir()")
def testBasedirCreatedQuiet(self): """ test creating new base directory with _makeBaseDir() and quiet flag enabled """ self.patch(os.path, "exists", mock.Mock(return_value=False)) # call _makeBaseDir() create_slave._makeBaseDir("dummy", True) # check that os.mkdir() was called with correct path self.mkdir.assert_called_once_with("dummy") # check that nothing was printed to stdout self.assertWasQuiet()
def testBasedirExists(self): """ test calling _makeBaseDir() on existing base directory """ self.patch(os.path, "exists", mock.Mock(return_value=True)) # call _makeBaseDir() create_slave._makeBaseDir("dummy", False) # check that correct message was printed to the log self.assertLogged("updating existing installation") # check that os.mkdir was not called self.assertFalse(self.mkdir.called, "unexpected call to os.mkdir()")
def testBasedirExistsQuiet(self): """ test calling _makeBaseDir() on existing base directory with quiet flag enabled """ self.patch(os.path, "exists", mock.Mock(return_value=True)) # call _makeBaseDir() create_slave._makeBaseDir("dummy", True) # check that nothing was printed to stdout self.assertWasQuiet() # check that os.mkdir was not called self.assertFalse(self.mkdir.called, "unexpected call to os.mkdir()")