Exemplo n.º 1
0
  def test_get_os_release_name(self, mock_linux_distribution):

    # 1 - Any system
    mock_linux_distribution.return_value = ('', '', 'MY_NEW_RELEASE')
    result = OSCheck.get_os_release_name()
    self.assertEquals(result, 'my_new_release')

    # 2 - Negative case
    mock_linux_distribution.return_value = ('aaaa', 'bbbb', '')
    try:
      result = OSCheck.get_os_release_name()
      self.fail("Should throw exception in OSCheck.get_os_release_name()")
    except Exception as e:
      # Expected
      self.assertEquals("Cannot detect os release name. Exiting...", str(e))
      pass
Exemplo n.º 2
0
 def os_release_name(self):
     """
 For Ubuntu 12.04:
 precise
 """
     return OSCheck.get_os_release_name()