def test_get_conflicts_with_not_equal_to_conflicts(self, mock_installed, mock_requirement): # Create some fake installed versions mock_installed.return_value = { 'one': '1.0', 'two': '2.0', 'three': '3.0' } # Create some fake requirements mock_requirement.return_value = { 'one': { 'three': [('!=', '1.0')] }, 'two': { 'three': [('!=', '2.0')] } } # Create the checker and get the conflicts checker = Checker() conflicts = checker.get_conflicts() # Assert we found the conflicts self.assertEqual(len(conflicts), 2)
def test_get_conflicts_no_conflicts(self, mock_installed, mock_requirement): # Create some fake installed versions mock_installed.return_value = { 'one': '1.0', 'two': '2.0', 'three': '3.0' } # Create some fake requirements mock_requirement.return_value = { 'one': { 'three': [('>=', '1.0')] }, 'two': { 'three': [('>=', '2.0')] } } checker = Checker() conflicts = checker.get_conflicts() self.assertFalse(len(conflicts))
def test_get_conflicts_with_req_not_in_installed(self, mock_installed, mock_requirement): # Create some fake installed versions mock_installed.return_value = { 'one': '1.0', 'two': '2.0', 'three': '3.0' } # Create some fake requirements mock_requirement.return_value = { 'four': { 'three': ['==', '1.0'] } } # Create the checker and get the conflicts checker = Checker() conflicts = checker.get_conflicts() # Assert we found the conflicts self.assertEqual(len(conflicts), 0)