def test_netns_wrap(self):
     self.conf.cmd = 'ls,-al'
     return_val = nswrap.execute_with_mount()
     exp_calls = [mock.call(['mount', '--bind', '/dir/foo', '/foo']),
                  mock.call(['mount', '--bind', '/dir/var', '/var']),
                  mock.call('ls,-al')]
     self.execute.assert_has_calls(exp_calls, any_order=True)
     self.assertFalse(return_val)
 def test_netns_wrap(self):
     self.conf.cmd = 'ls,-al'
     return_val = nswrap.execute_with_mount()
     exp_calls = [
         mock.call(['mount', '--bind', '/dir/foo', '/foo']),
         mock.call(['mount', '--bind', '/dir/var', '/var']),
         mock.call('ls,-al')
     ]
     self.execute.assert_has_calls(exp_calls, any_order=True)
     self.assertFalse(return_val)
 def test_netns_wrap_fail_without_mount_paths(self):
     self.conf.mount_paths = None
     return_val = nswrap.execute_with_mount()
     self.assertFalse(self.execute.called)
     self.assertTrue(return_val)
 def test_netns_wrap_fail_without_netns(self):
     self.samefile.return_value = True
     return_val = nswrap.execute_with_mount()
     self.assertTrue(return_val)
 def test_netns_wrap_fail_without_mount_paths(self):
     self.conf.mount_paths = None
     return_val = nswrap.execute_with_mount()
     self.assertFalse(self.execute.called)
     self.assertTrue(return_val)
 def test_netns_wrap_fail_without_netns(self):
     self.samefile.return_value = True
     return_val = nswrap.execute_with_mount()
     self.assertTrue(return_val)