salt/tests/integration/fileserver/fileclient_test.py
Mike Place 55ecc5d0ab Starting work on new set of tests for fileclient.
Also, more integration testing for templates.
2013-12-09 16:47:49 -07:00

47 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
'''
:codauthor: :email:`Mike Place <mp@saltstack.com>`
'''
# Import Salt Testing libs
from salttesting.helpers import (ensure_in_syspath, destructiveTest)
from salttesting.mock import MagicMock, patch
ensure_in_syspath('../')
# Import salt libs
import integration
from salt import fileclient
# Import Python libs
import os
class FileClientTest(integration.ModuleCase):
def setUp(self):
self.file_client = fileclient.Client(self.master_opts)
def test_file_list_emptydirs(self):
'''
Ensure that the fileclient class won't allow a direct call to file_list_emptydirs()
'''
with self.assertRaises(NotImplementedError):
self.file_client.file_list_emptydirs()
def test_get_file(self):
'''
Ensure that the fileclient class won't allow a direct call to get_file()
'''
with self.assertRaises(NotImplementedError):
self.file_client.get_file(None)
def test_get_file_client(self):
with patch.dict(self.minion_opts, {'file_client': 'remote'}):
with patch('salt.fileclient.RemoteClient', MagicMock(return_value='remote_client')):
ret = fileclient.get_file_client(self.minion_opts)
self.assertEqual('remote_client', ret)
if __name__ == '__main__':
from integration import run_tests
run_tests(FileClientTest)