示例#1
0
    def test_methods_structure(self):
        """Test that VERSIONED_METHODS gets data as expected."""
        self.assertEqual(0, len(microversion.VERSIONED_METHODS))
        fully_qualified_method = microversion._fully_qualified_name(handler)
        microversion.version_handler('1.0', '1.9')(handler)
        microversion.version_handler('2.0')(handler)

        methods_data = microversion.VERSIONED_METHODS[fully_qualified_method]

        stored_method_data = methods_data[-1]
        self.assertEqual(2, len(methods_data))
        self.assertEqual(1.0, stored_method_data[0])
        self.assertEqual(1.9, stored_method_data[1])
        self.assertEqual(handler, stored_method_data[2])
        self.assertEqual(2.0, methods_data[0][0])
示例#2
0
    def test_methods_structure(self):
        """Test that VERSIONED_METHODS gets data as expected."""
        self.assertEqual(0, len(microversion.VERSIONED_METHODS))
        fully_qualified_method = microversion._fully_qualified_name(
            handler)
        microversion.version_handler('1.1', '1.10')(handler)
        microversion.version_handler('2.0')(handler)

        methods_data = microversion.VERSIONED_METHODS[fully_qualified_method]

        stored_method_data = methods_data[-1]
        self.assertEqual(2, len(methods_data))
        self.assertEqual(microversion.Version(1, 1), stored_method_data[0])
        self.assertEqual(microversion.Version(1, 10), stored_method_data[1])
        self.assertEqual(handler, stored_method_data[2])
        self.assertEqual(microversion.Version(2, 0), methods_data[0][0])