mirror of https://github.com/docker/docker-py.git
docs and unit test for security_opt
This commit is contained in:
parent
1845d3b13f
commit
b097d19f2f
|
|
@ -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)
|
* extra_hosts (dict): custom host-to-IP mappings (host:ip)
|
||||||
* pid_mode (str): if set to "host", use the host PID namespace inside the
|
* pid_mode (str): if set to "host", use the host PID namespace inside the
|
||||||
container
|
container
|
||||||
|
* security_opt (list): A list of string values to customize labels for MLS systems, such as SELinux.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
>>> from docker import Client
|
>>> from docker import Client
|
||||||
|
|
|
||||||
|
|
@ -2270,6 +2270,19 @@ class DockerClientTest(Cleanup, unittest.TestCase):
|
||||||
tar = tarfile.open(fileobj=archive)
|
tar = tarfile.open(fileobj=archive)
|
||||||
self.assertEqual(sorted(tar.getnames()), ['bar', 'bar/foo', 'foo'])
|
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):
|
class StreamTest(Cleanup, unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue