~ubuntu-branches/debian/stretch/waagent/stretch

« back to all changes in this revision

Viewing changes to tests/test_version.py

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2016-02-11 16:40:04 UTC
  • mfrom: (1.2.3)
  • Revision ID: package-import@ubuntu.com-20160211164004-m9chank2yihdviil
Tags: 2.1.3-1
* New upstream version.
* Only create /var/lib/waagent on initial installation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2014 Microsoft Corporation
2
 
#
3
 
# Licensed under the Apache License, Version 2.0 (the "License");
4
 
# you may not use this file except in compliance with the License.
5
 
# You may obtain a copy of the License at
6
 
#
7
 
#     http://www.apache.org/licenses/LICENSE-2.0
8
 
#
9
 
# Unless required by applicable law or agreed to in writing, software
10
 
# distributed under the License is distributed on an "AS IS" BASIS,
11
 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 
# See the License for the specific language governing permissions and
13
 
# limitations under the License.
14
 
#
15
 
# Requires Python 2.4+ and Openssl 1.0+
16
 
#
17
 
# Implements parts of RFC 2131, 1541, 1497 and
18
 
# http://msdn.microsoft.com/en-us/library/cc227282%28PROT.10%29.aspx
19
 
# http://msdn.microsoft.com/en-us/library/cc227259%28PROT.13%29.aspx
20
 
 
21
 
import tests.env
22
 
import tests.tools as tools
23
 
import uuid
24
 
import unittest
25
 
import os
26
 
import json
27
 
import azurelinuxagent.protocol.v1 as v1
28
 
from azurelinuxagent.future import text
29
 
 
30
 
VersionInfoSample=u"""\
31
 
<?xml version="1.0" encoding="utf-8"?>
32
 
<Versions>
33
 
  <Preferred>
34
 
    <Version>2012-11-30</Version>
35
 
  </Preferred>
36
 
  <Supported>
37
 
    <Version>2010-12-15</Version>
38
 
    <Version>2010-28-10</Version>
39
 
  </Supported>
40
 
</Versions>
41
 
"""
42
 
 
43
 
class TestVersionInfo(unittest.TestCase):
44
 
    def test_version_info(self):
45
 
        config = v1.VersionInfo(VersionInfoSample)
46
 
        self.assertEquals("2012-11-30", config.get_preferred())
47
 
        self.assertNotEquals(None, config.get_supported())
48
 
        self.assertEquals(2, len(config.get_supported()))
49
 
        self.assertEquals("2010-12-15", config.get_supported()[0])
50
 
        self.assertEquals("2010-28-10", config.get_supported()[1])
51
 
   
52
 
if __name__ == '__main__':
53
 
    unittest.main()