def testSetSELinuxContext(self, mock_isfile, mock_access, mock_call):
   restorecon = '/sbin/restorecon'
   path = 'path'
   mock_isfile.return_value = True
   mock_access.return_value = True
   file_utils._SetSELinuxContext(path)
   mock_isfile.assert_called_once_with(restorecon)
   mock_access.assert_called_once_with(restorecon, file_utils.os.X_OK)
   mock_call.assert_called_once_with([restorecon, path])
 def testSetSELinuxContext(self, mock_isfile, mock_access, mock_call):
     restorecon = '/sbin/restorecon'
     path = 'path'
     mock_isfile.return_value = True
     mock_access.return_value = True
     file_utils._SetSELinuxContext(path)
     mock_isfile.assert_called_once_with(restorecon)
     mock_access.assert_called_once_with(restorecon, file_utils.os.X_OK)
     mock_call.assert_called_once_with([restorecon, path])
 def testSetSELinuxContextSkip(self, mock_isfile, mock_access, mock_call):
   mock_isfile.side_effect = [True, False, False]
   mock_access.side_effect = [False, True, False]
   file_utils._SetSELinuxContext('1')
   file_utils._SetSELinuxContext('2')
   file_utils._SetSELinuxContext('3')
   mock_call.assert_not_called()
 def testSetSELinuxContextSkip(self, mock_isfile, mock_access, mock_call):
     mock_isfile.side_effect = [True, False, False]
     mock_access.side_effect = [False, True, False]
     file_utils._SetSELinuxContext('1')
     file_utils._SetSELinuxContext('2')
     file_utils._SetSELinuxContext('3')
     mock_call.assert_not_called()