/usr/lib/python2.7/dist-packages/chef/tests/test_api.py is in python-chef 0.2.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import os
import unittest2
from chef.api import ChefAPI
class APITestCase(unittest2.TestCase):
def load(self, path):
path = os.path.join(os.path.dirname(__file__), 'configs', path)
return ChefAPI.from_config_file(path)
def test_basic(self):
api = self.load('basic.rb')
self.assertEqual(api.url, 'http://chef:4000')
self.assertEqual(api.client, 'test_1')
def test_current_dir(self):
api = self.load('current_dir.rb')
path = os.path.join(os.path.dirname(__file__), 'configs', 'test_1')
self.assertEqual(api.client, path)
def test_env_variables(self):
try:
os.environ['_PYCHEF_TEST_'] = 'foobar'
api = self.load('env_values.rb')
self.assertEqual(api.client, 'foobar')
finally:
del os.environ['_PYCHEF_TEST_']
|