def test_get_file_not_found(self): ''' Test if get_file can't find the file. ''' path = 'salt://saltines' dest = '/srv/salt/cheese' ret = '' self.assertEqual(cp.get_file(path, dest), ret)
def test_get_file_not_found(): """ Test if get_file can't find the file. """ with patch("salt.modules.cp.hash_file", MagicMock(return_value=False)): path = "salt://saltines" dest = "/srv/salt/cheese" ret = "" assert cp.get_file(path, dest) == ret
def test_get_file_not_found(self): ''' Test if get_file can't find the file. ''' with patch('salt.modules.cp.hash_file', MagicMock(return_value=False)): path = 'salt://saltines' dest = '/srv/salt/cheese' ret = '' self.assertEqual(cp.get_file(path, dest), ret)
def test_get_file_success(self): ''' Test if get_file succeeds. ''' path = 'salt://saltines' dest = '/srv/salt/cheese' saltenv = 'base' ret = (path, dest, False, saltenv, None) class MockFileClient(object): def get_file(self, *args): return args mock_file_client = MockFileClient() with patch.dict(cp.__context__, {'cp.fileclient': mock_file_client}): self.assertEqual(cp.get_file(path, dest), ret)