Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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()
Example #4
0
    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()