def test_scan_when_unknown(self): # Prepare data and mocks with patch('platform.linux_distribution', lambda: ('Unknown linux distribution', None, None)): update = Update(None) # Run test scenario result = update.scan() # Assertions self.assertEqual(result[0], ScanStatus.unknown)
def test_scan_when_redhat(self): # Prepare data and mocks with patch('platform.linux_distribution', lambda: ('redhat', None, None)): update = Update(None) update.scan_redhat = MagicMock(return_value=(ScanStatus.unknown, 'message')) # Run test scenario result = update.scan() # Assertions self.assertEqual(result, (ScanStatus.unknown, 'message')) update.scan_redhat.assert_called_once_with()