dstandish commented on a change in pull request #14157:
URL: https://github.com/apache/airflow/pull/14157#discussion_r585027242



##########
File path: tests/providers/docker/operators/test_docker.py
##########
@@ -260,3 +261,27 @@ def test_extra_hosts(self):
         assert 'host_config' in self.client_mock.create_container.call_args[1]
         assert 'extra_hosts' in 
self.client_mock.create_host_config.call_args[1]
         assert hosts_obj is 
self.client_mock.create_host_config.call_args[1]['extra_hosts']
+
+    def test_privileged_true(self):
+        operator = DockerOperator(task_id='test', image='test', 
privileged=True)
+        operator.execute(None)
+        self.client_mock.create_container.assert_called_once()
+        assert 'host_config' in self.client_mock.create_container.call_args[1]
+        assert 'privileged' in self.client_mock.create_host_config.call_args[1]
+        assert True is 
self.client_mock.create_host_config.call_args[1]['privileged']
+
+    def test_privileged_false(self):
+        operator = DockerOperator(task_id='test', image='test', 
privileged=False)
+        operator.execute(None)
+        self.client_mock.create_container.assert_called_once()
+        assert 'host_config' in self.client_mock.create_container.call_args[1]
+        assert 'privileged' in self.client_mock.create_host_config.call_args[1]
+        assert False is 
self.client_mock.create_host_config.call_args[1]['privileged']
+
+    def test_privileged_missing(self):
+        operator = DockerOperator(task_id='test', image='test')
+        operator.execute(None)
+        self.client_mock.create_container.assert_called_once()
+        assert 'host_config' in self.client_mock.create_container.call_args[1]
+        assert 'privileged' in self.client_mock.create_host_config.call_args[1]
+        assert False is 
self.client_mock.create_host_config.call_args[1]['privileged']

Review comment:
       would like to suggest you parameterize this set of tests




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to