def test_in_exacts_false(self):
     installed_version = '2.0'
     specs = [
         ('==', '1.0'),
     ]
     validator = Validator(installed_version, specs)
     self.assertFalse(validator.in_exacts())
 def test_in_exacts_false(self):
     installed_version = '2.0'
     specs = [
         ('==', '1.0'),
     ]
     validator = Validator(installed_version, specs)
     self.assertFalse(validator.in_exacts())
Exemplo n.º 3
0
    def test_in_ranges_no_ranges(self):
        installed_version = '2.0'
        specs = []
        validator = Validator(installed_version, specs)

        # Validate we are in the range
        self.assertTrue(validator.in_ranges())
 def test_in_excludes_false(self):
     installed_version = '1.2'
     specs = [
         ('>=', '1.0'),
         ('!=', '1.1'),
     ]
     validator = Validator(installed_version, specs)
     self.assertFalse(validator.in_excludes())
 def test_is_valid_false_one_range(self):
     installed_version = '3.0'
     specs = [
         ('>=', '1.0'),
         ('<=', '2.0'),
     ]
     validator = Validator(installed_version, specs)
     self.assertFalse(validator.is_valid())
    def test_in_ranges_no_ranges(self):
        installed_version = '2.0'
        specs = [
        ]
        validator = Validator(installed_version, specs)

        # Validate we are in the range
        self.assertTrue(validator.in_ranges())
 def test_in_excludes_false(self):
     installed_version = '1.2'
     specs = [
         ('>=', '1.0'),
         ('!=', '1.1'),
     ]
     validator = Validator(installed_version, specs)
     self.assertFalse(validator.in_excludes())
 def test_is_valid_false_one_range(self):
     installed_version = '3.0'
     specs = [
         ('>=', '1.0'),
         ('<=', '2.0'),
     ]
     validator = Validator(installed_version, specs)
     self.assertFalse(validator.is_valid())
 def test_is_valid_false_in_excludes_in_ranges(self):
     installed_version = '1.5'
     specs = [
         ('>=', '1.0'),
         ('<=', '2.0'),
         ('!=', '1.5'),
     ]
     validator = Validator(installed_version, specs)
     self.assertFalse(validator.is_valid())
    def test_in_ranges_true_no_max_edge(self):
        installed_version = '1.0'
        specs = [
            ('>=', '1.0'),
        ]
        validator = Validator(installed_version, specs)

        # Validate we are in the range
        self.assertTrue(validator.in_ranges())
    def test_in_ranges_true_no_max_edge(self):
        installed_version = '1.0'
        specs = [
            ('>=', '1.0'),
        ]
        validator = Validator(installed_version, specs)

        # Validate we are in the range
        self.assertTrue(validator.in_ranges())
    def test_in_ranges_false_no_max_edge(self):
        installed_version = '1.0'
        specs = [
            ('>', '1.0'),
        ]
        validator = Validator(installed_version, specs)

        # Validate we are not in the range
        self.assertFalse(validator.in_ranges())
    def test_in_ranges_false_no_max_edge(self):
        installed_version = '1.0'
        specs = [
            ('>', '1.0'),
        ]
        validator = Validator(installed_version, specs)

        # Validate we are not in the range
        self.assertFalse(validator.in_ranges())
 def test_is_valid_false_in_excludes_in_ranges(self):
     installed_version = '1.5'
     specs = [
         ('>=', '1.0'),
         ('<=', '2.0'),
         ('!=', '1.5'),
     ]
     validator = Validator(installed_version, specs)
     self.assertFalse(validator.is_valid())
 def test_is_valid_true_in_exacts_not_in_ranges(self):
     installed_version = '3.0'
     specs = [
         ('>=', '1.0'),
         ('<=', '2.0'),
         ('==', '3.0'),
     ]
     validator = Validator(installed_version, specs)
     self.assertTrue(validator.is_valid())
 def test_is_valid_true_in_exacts_not_in_ranges(self):
     installed_version = '3.0'
     specs = [
         ('>=', '1.0'),
         ('<=', '2.0'),
         ('==', '3.0'),
     ]
     validator = Validator(installed_version, specs)
     self.assertTrue(validator.is_valid())
 def test_is_valid_true_multi_range(self):
     installed_version = '2.0'
     specs = [
         ('>=', '1.0'),
         ('<=', '2.0'),
         ('>=', '3.0'),
         ('<=', '4.0'),
     ]
     validator = Validator(installed_version, specs)
     self.assertTrue(validator.is_valid())
 def test_is_valid_true_multi_range(self):
     installed_version = '2.0'
     specs = [
         ('>=', '1.0'),
         ('<=', '2.0'),
         ('>=', '3.0'),
         ('<=', '4.0'),
     ]
     validator = Validator(installed_version, specs)
     self.assertTrue(validator.is_valid())
Exemplo n.º 19
0
    def test_ranges_no_min(self):
        installed_version = '0.1'
        specs = [('<=', '1.0')]
        validator = Validator(installed_version, specs)
        ranges = validator.get_required_version_ranges()

        # Validate there is only one range
        self.assertEqual(len(ranges), 1)

        # Validate that there is no max spec
        self.assertIsNone(ranges[0][0])
Exemplo n.º 20
0
    def test_ranges_min_and_max(self):
        installed_version = '1.0'
        specs = [('<=', '2.0'), ('>=', '1.0')]
        validator = Validator(installed_version, specs)
        ranges = validator.get_required_version_ranges()

        # Validate there is only one range
        self.assertEqual(len(ranges), 1)

        # Validate that the min and max are correct
        self.assertEqual(ranges[0][0], specs[1])
        self.assertEqual(ranges[0][1], specs[0])
    def test_ranges_multiple_no_max(self):
        installed_version = '1.0'
        specs = [
            ('>=', '1.0'),
            ('<=', '2.0'),
            ('>=', '3.0'),
        ]
        validator = Validator(installed_version, specs)
        ranges = validator.get_required_version_ranges()

        # Validate the number of ranges
        self.assertEqual(len(ranges), 2)
    def test_ranges_multiple_no_max(self):
        installed_version = '1.0'
        specs = [
            ('>=', '1.0'),
            ('<=', '2.0'),
            ('>=', '3.0'),
        ]
        validator = Validator(installed_version, specs)
        ranges = validator.get_required_version_ranges()

        # Validate the number of ranges
        self.assertEqual(len(ranges), 2)
    def test_ranges_no_min(self):
        installed_version = '0.1'
        specs = [
            ('<=', '1.0')
        ]
        validator = Validator(installed_version, specs)
        ranges = validator.get_required_version_ranges()

        # Validate there is only one range
        self.assertEqual(len(ranges), 1)

        # Validate that there is no max spec
        self.assertIsNone(ranges[0][0])
    def test_exacts(self):
        installed_version = '1.0'
        specs = [
            ('>=', '1.0'),
            ('<=', '2.0'),
            ('>=', '3.0'),
            ('==', '2.5'),
        ]
        validator = Validator(installed_version, specs)
        exacts = validator.get_required_version_exacts()

        # Validate the number of exacts
        self.assertEqual(len(exacts), 1)
    def test_exacts(self):
        installed_version = '1.0'
        specs = [
            ('>=', '1.0'),
            ('<=', '2.0'),
            ('>=', '3.0'),
            ('==', '2.5'),
        ]
        validator = Validator(installed_version, specs)
        exacts = validator.get_required_version_exacts()

        # Validate the number of exacts
        self.assertEqual(len(exacts), 1)
    def test_ranges_min_and_max(self):
        installed_version = '1.0'
        specs = [
            ('<=', '2.0'),
            ('>=', '1.0')
        ]
        validator = Validator(installed_version, specs)
        ranges = validator.get_required_version_ranges()

        # Validate there is only one range
        self.assertEqual(len(ranges), 1)

        # Validate that the min and max are correct
        self.assertEqual(ranges[0][0], specs[1])
        self.assertEqual(ranges[0][1], specs[0])
Exemplo n.º 27
0
    def test_init(self):
        installed_version = '1.0'
        specs = [('<=', '2.0'), ('>=', '1.0')]
        validator = Validator(installed_version, specs)

        # Assert that the properties were set
        self.assertTrue(validator.installed_version, installed_version)
        self.assertTrue(validator.required_version_specs, specs)

        # Assert that the required version specs were sorted properly
        self.assertTrue(validator.required_version_specs[0], specs[1])
        self.assertTrue(validator.required_version_specs[1], specs[0])