Revision 28f34048 test/ganeti.utils_unittest.py
b/test/ganeti.utils_unittest.py | ||
---|---|---|
1910 | 1910 |
HostInfo.NormalizeName(value) |
1911 | 1911 |
|
1912 | 1912 |
|
1913 |
class TestValidateServiceName(unittest.TestCase): |
|
1914 |
def testValid(self): |
|
1915 |
testnames = [ |
|
1916 |
0, 1, 2, 3, 1024, 65000, 65534, 65535, |
|
1917 |
"ganeti", |
|
1918 |
"gnt-masterd", |
|
1919 |
"HELLO_WORLD_SVC", |
|
1920 |
"hello.world.1", |
|
1921 |
"0", "80", "1111", "65535", |
|
1922 |
] |
|
1923 |
|
|
1924 |
for name in testnames: |
|
1925 |
self.assertEqual(utils.ValidateServiceName(name), name) |
|
1926 |
|
|
1927 |
def testInvalid(self): |
|
1928 |
testnames = [ |
|
1929 |
-15756, -1, 65536, 133428083, |
|
1930 |
"", "Hello World!", "!", "'", "\"", "\t", "\n", "`", |
|
1931 |
"-8546", "-1", "65536", |
|
1932 |
(129 * "A"), |
|
1933 |
] |
|
1934 |
|
|
1935 |
for name in testnames: |
|
1936 |
self.assertRaises(OpPrereqError, utils.ValidateServiceName, name) |
|
1937 |
|
|
1938 |
|
|
1913 | 1939 |
class TestParseAsn1Generalizedtime(unittest.TestCase): |
1914 | 1940 |
def test(self): |
1915 | 1941 |
# UTC |
Also available in: Unified diff