예제 #1
0
 def test_same(self):
     """Assert output when lower and upper are identical"""
     input = ['1.1', '1.1']
     expected = ('($device.osVersion.major = 1 AND ' +
                 '$device.osVersion.minor = 1)')
     output = get_version_query(input)
     self.assertEqual(output, expected)
예제 #2
0
 def test_no_upper(self):
     """Assert output when there is no upper limit"""
     input = ['3.3', '']
     expected = ('($device.osVersion.major >= 4) ' +
                 'OR ' +
                 '($device.osVersion.major = 3 AND ' +
                 '$device.osVersion.minor >= 3)')
     output = get_version_query(input)
     self.assertEqual(output, expected)
예제 #3
0
 def test_min_minor_zero(self):
     """Assert output when lower has minor == 0"""
     input = ['2.0', '6.0']
     expected = ('($device.osVersion.major >= 2 AND ' +
                 '$device.osVersion.major <= 5) ' +
                 'OR ' +
                 '($device.osVersion.major = 6 AND ' +
                 '$device.osVersion.minor <= 0)')
     output = get_version_query(input)
     self.assertEqual(output, expected)
예제 #4
0
 def test_same_major(self):
     """Assert output when lower and upper share the same major"""
     input = ['5.5', '5.6']
     expected = ('($device.osVersion.major = 5 AND ' +
                 '$device.osVersion.minor >= 5) ' +
                 'AND ' +
                 '($device.osVersion.major = 5 AND ' +
                 '$device.osVersion.minor <= 6)')
     output = get_version_query(input)
     self.assertEqual(output, expected)
예제 #5
0
 def test_within_one(self):
     """Assert output when lower and upper are within one of each other"""
     input = ['5.2', '6.1']
     expected = ('($device.osVersion.major = 5 AND ' +
                 '$device.osVersion.minor >= 2) ' +
                 'OR ' +
                 '($device.osVersion.major = 6 AND ' +
                 '$device.osVersion.minor <= 1)')
     output = get_version_query(input)
     self.assertEqual(output, expected)
예제 #6
0
 def test_with_upper_1(self):
     """Assert output when there is an upper limit"""
     input = ['1.1', '3.4']
     expected = ('($device.osVersion.major >= 2 AND ' +
                 '$device.osVersion.major <= 2) ' +
                 'OR ' +
                 '($device.osVersion.major = 1 AND ' +
                 '$device.osVersion.minor >= 1) ' +
                 'OR ' +
                 '($device.osVersion.major = 3 AND ' +
                 '$device.osVersion.minor <= 4)')
     output = get_version_query(input)
     self.assertEqual(output, expected)
예제 #7
0
 def test_no_upper_min_minor_zero(self):
     """Assert output when there is no upper limit and lower minor == 0"""
     input = ['3.0', '']
     expected = '($device.osVersion.major >= 3)'
     output = get_version_query(input)
     self.assertEqual(output, expected)