2 # Copyright (C) 2019 EfficiOS Inc.
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; only version 2
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 class MipTestCase(unittest
.TestCase
):
24 def test_get_greatest_operative_mip_version(self
):
26 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
29 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
33 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
36 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
40 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
45 bt2
.ComponentDescriptor(Source1
),
46 bt2
.ComponentDescriptor(Source2
),
47 bt2
.ComponentDescriptor(Source3
),
49 version
= bt2
.get_greatest_operative_mip_version(descriptors
)
50 self
.assertEqual(version
, 0)
52 def test_get_greatest_operative_mip_version_no_match(self
):
54 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
57 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
61 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
64 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
68 bt2
.ComponentDescriptor(Source1
),
69 bt2
.ComponentDescriptor(Source2
),
72 version
= bt2
.get_greatest_operative_mip_version(descriptors
)
73 self
.assertIsNone(version
)
75 def test_get_greatest_operative_mip_version_empty_descriptors(self
):
76 with self
.assertRaises(ValueError):
77 bt2
.get_greatest_operative_mip_version([])
79 def test_get_greatest_operative_mip_version_wrong_descriptor_type(self
):
81 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
84 def _user_get_supported_mip_versions(cls
, params
, obj
, log_level
):
87 descriptors
= [bt2
.ComponentDescriptor(Source1
), object()]
89 with self
.assertRaises(TypeError):
90 bt2
.get_greatest_operative_mip_version(descriptors
)
92 def test_get_greatest_operative_mip_version_wrong_log_level_type(self
):
94 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
98 descriptors
= [bt2
.ComponentDescriptor(Source1
)]
100 with self
.assertRaises(TypeError):
101 bt2
.get_greatest_operative_mip_version(descriptors
, 'lel')
103 def test_get_greatest_operative_mip_version_wrong_log_level_value(self
):
105 bt2
._UserSourceComponent
, message_iterator_class
=bt2
._UserMessageIterator
109 descriptors
= [bt2
.ComponentDescriptor(Source1
)]
111 with self
.assertRaises(ValueError):
112 bt2
.get_greatest_operative_mip_version(descriptors
, 12345)
114 def test_get_maximal_mip_version(self
):
115 self
.assertEqual(bt2
.get_maximal_mip_version(), 0)
118 if __name__
== '__main__':
This page took 0.03783 seconds and 4 git commands to generate.