Exemplo n.º 1
0
 def test_valid_versions(self):
     """Test valid version formats"""
     linter = Mock()
     versions = ["2.0.1", "2.0.1.1", "2.1-beta2", "2.1-beta2.1"]
     for v in versions:
         charm = {"min-juju-version": v}
         validate_min_juju_version(charm, linter)
         self.assertFalse(linter.err.called)
         linter.reset_mock()
Exemplo n.º 2
0
 def test_invalid_versions(self):
     """Test invalid versions (good format, bad version)"""
     linter = Mock()
     versions = ["1.25.3"]  # need 2.0.0 or greater
     for v in versions:
         charm = {"min-juju-version": v}
         validate_min_juju_version(charm, linter)
         linter.err.assert_called_once_with("min-juju-version: invalid version, must be 2.0.0 or greater")
         linter.reset_mock()
Exemplo n.º 3
0
 def test_invalid_version_formats(self):
     """Test invalid version formats"""
     linter = Mock()
     versions = ["2", "2.0", "2-beta3"]  # need major.minor.patch  # need major.minor.patch  # missing minor
     for v in versions:
         charm = {"min-juju-version": v}
         validate_min_juju_version(charm, linter)
         linter.err.assert_called_once_with("min-juju-version: invalid format, try X.Y.Z")
         linter.reset_mock()
Exemplo n.º 4
0
 def test_invalid_versions(self):
     """Test invalid versions (good format, bad version)"""
     linter = Mock()
     versions = [
         '1.25.3',  # need 2.0.0 or greater
     ]
     for v in versions:
         charm = {
             'min-juju-version': v,
         }
         validate_min_juju_version(charm, linter)
         linter.err.assert_called_once_with(
             'min-juju-version: invalid version, must be 2.0.0 or greater')
         linter.reset_mock()
Exemplo n.º 5
0
 def test_valid_versions(self):
     """Test valid version formats"""
     linter = Mock()
     versions = [
         '2.0.1',
         '2.0.1.1',
         '2.1-beta2',
         '2.1-beta2.1',
     ]
     for v in versions:
         charm = {
             'min-juju-version': v,
         }
         validate_min_juju_version(charm, linter)
         self.assertFalse(linter.err.called)
         linter.reset_mock()
Exemplo n.º 6
0
 def test_invalid_version_formats(self):
     """Test invalid version formats"""
     linter = Mock()
     versions = [
         '2',  # need major.minor.patch
         '2.0',  # need major.minor.patch
         '2-beta3',  # missing minor
     ]
     for v in versions:
         charm = {
             'min-juju-version': v,
         }
         validate_min_juju_version(charm, linter)
         linter.err.assert_called_once_with(
             'min-juju-version: invalid format, try X.Y.Z')
         linter.reset_mock()