docs and unit test for security_opt

This commit is contained in:
Joffrey F 2015-03-25 15:40:14 -07:00
parent 1845d3b13f
commit b097d19f2f
2 changed files with 14 additions and 0 deletions

View File

@ -700,6 +700,7 @@ from. Optionally a single string joining container id's with commas
* extra_hosts (dict): custom host-to-IP mappings (host:ip)
* pid_mode (str): if set to "host", use the host PID namespace inside the
container
* security_opt (list): A list of string values to customize labels for MLS systems, such as SELinux.
```python
>>> from docker import Client

View File

@ -2270,6 +2270,19 @@ class DockerClientTest(Cleanup, unittest.TestCase):
tar = tarfile.open(fileobj=archive)
self.assertEqual(sorted(tar.getnames()), ['bar', 'bar/foo', 'foo'])
#######################
# HOST CONFIG TESTS #
#######################
def test_create_host_config_secopt(self):
security_opt = ['apparmor:test_profile']
result = create_host_config(security_opt=security_opt)
self.assertIn('SecurityOpt', result)
self.assertEqual(result['SecurityOpt'], security_opt)
with self.assertRaises(docker.errors.DockerException):
create_host_config(security_opt='wrong')
class StreamTest(Cleanup, unittest.TestCase):