예제 #1
0
파일: test_pkg.py 프로젝트: tschmittni/salt
 def test_fulfills_version_string(self):
     test_parameters = [
         ("> 1.0.0, < 15.0.0, != 14.0.1", [], False),
         ("> 1.0.0, < 15.0.0, != 14.0.1", ["1.0.0"], False),
         ("> 1.0.0, < 15.0.0, != 14.0.1", ["14.0.1"], False),
         ("> 1.0.0, < 15.0.0, != 14.0.1", ["16.0.0"], False),
         ("> 1.0.0, < 15.0.0, != 14.0.1", ["2.0.0"], True),
         ("> 1.0.0, < 15.0.0, != 14.0.1",
          ["1.0.0", "14.0.1", "16.0.0", "2.0.0"], True),
         ("> 15.0.0", [], False),
         ("> 15.0.0", ["1.0.0"], False),
         ("> 15.0.0", ["16.0.0"], True),
         ("15.0.0", [], False),
         ("15.0.0", ["15.0.0"], True),
         # No version specified, whatever version installed. This is threated like ANY version installed fulfills.
         ("", ["15.0.0"], True),
         # No version specified, no version installed.
         ("", [], False)
     ]
     for version_string, installed_versions, expected_result in test_parameters:
         msg = "version_string: %s, installed_versions: %s, expected_result: %s" % (
             version_string, installed_versions, expected_result)
         self.assertEqual(
             expected_result,
             pkg._fulfills_version_string(installed_versions,
                                          version_string), msg)
예제 #2
0
def test_fulfills_version_string(version_string, installed_versions, expected_result):
    msg = "version_string: {}, installed_versions: {}, expected_result: {}".format(
        version_string, installed_versions, expected_result
    )
    assert expected_result == pkg._fulfills_version_string(
        installed_versions, version_string
    )