Esempio n. 1
0
    def test_resolve_api_provider_latest_include_preview(self):
        # Verifies provider is used as backup if api-version not specified.
        from azure.cli.core.mock import DummyCli
        cli = DummyCli()
        rcf = self._get_mock_client()
        res_utils = _ResourceUtils(cli, resource_type='Mock/test_latest', resource_name='vnet1',
                                   resource_group_name='rg', rcf=rcf)
        self.assertEqual(res_utils.api_version, "2015-01-01")

        res_utils = _ResourceUtils(cli, resource_type='Mock/test_latest', resource_name='vnet1',
                                   resource_group_name='rg', rcf=rcf, latest_include_preview=True)
        self.assertEqual(res_utils.api_version, "2016-01-01-preview")
Esempio n. 2
0
 def test_resolve_api_provider_with_parent_backup(self):
     """ Verifies provider (with parent) is used as backup if api-version not specified. """
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(parent_resource_path='foo/testfoo123', resource_group_name='rg',
                                resource_provider_namespace='Mock', resource_type='test', resource_name='vnet1',
                                rcf=rcf)
     self.assertEqual(res_utils.api_version, "1999-01-01")
Esempio n. 3
0
 def test_resolve_api_all_previews(self):
     """ Verifies most recent preview version returned only if there are no non-preview versions. """
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(resource_type='Mock/preview',
                                resource_name='vnet1',
                                rcf=rcf)
     self.assertEqual(res_utils.api_version, "2005-01-01-preview")
 def test_resolve_api_provider_with_parent_backup(self):
     """ Verifies provider (with parent) is used as backup if api-version not specified. """
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(parent_resource_path='foo/testfoo123', resource_group_name='rg',
                                resource_provider_namespace='Mock', resource_type='test', resource_name='vnet1',
                                rcf=rcf)
     self.assertEqual(res_utils.api_version, "1999-01-01")
Esempio n. 5
0
 def test_resolve_api_provider_backup(self):
     """ Verifies provider is used as backup if api-version not specified. """
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(resource_type='Mock/test',
                                resource_name='vnet1',
                                rcf=rcf)
     self.assertEqual(res_utils.api_version, "2016-01-01")
Esempio n. 6
0
 def test_resolve_api_all_previews(self):
     # Verifies most recent preview version returned only if there are no non-preview versions.
     from azure.cli.core.mock import DummyCli
     cli = DummyCli()
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(cli, resource_type='Mock/preview', resource_name='vnet1',
                                resource_group_name='rg', rcf=rcf)
     self.assertEqual(res_utils.api_version, "2005-01-01-preview")
Esempio n. 7
0
 def test_resolve_api_all_previews(self):
     # Verifies most recent preview version returned only if there are no non-preview versions.
     from azure.cli.testsdk import TestCli
     cli = TestCli()
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(cli, resource_type='Mock/preview', resource_name='vnet1',
                                resource_group_name='rg', rcf=rcf)
     self.assertEqual(res_utils.api_version, "2005-01-01-preview")
Esempio n. 8
0
 def test_resolve_api_provider_backup(self):
     # Verifies provider is used as backup if api-version not specified.
     from azure.cli.testsdk import TestCli
     cli = TestCli()
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(cli, resource_type='Mock/test', resource_name='vnet1',
                                resource_group_name='rg', rcf=rcf)
     self.assertEqual(res_utils.api_version, "2016-01-01")
Esempio n. 9
0
 def test_resolve_api_all_previews(self):
     """
     Verifies most recent preview version returned only if there are no non-preview versions.
     """
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(resource_type='Mock/preview', resource_name='vnet1',
                                resource_group_name='rg', rcf=rcf)
     self.assertEqual(res_utils.api_version, "2005-01-01-preview")
Esempio n. 10
0
 def test_resolve_api_provider_backup(self):
     # Verifies provider is used as backup if api-version not specified.
     from azure.cli.testsdk import TestCli
     cli = TestCli()
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(cli,
                                resource_type='Mock/test',
                                resource_name='vnet1',
                                resource_group_name='rg',
                                rcf=rcf)
     self.assertEqual(res_utils.api_version, "2016-01-01")
 def test_resolve_api_provider_backup(self):
     """ Verifies provider is used as backup if api-version not specified. """
     rcf = self._get_mock_client()
     res_utils = _ResourceUtils(resource_type='Mock/test', resource_name='vnet1', resource_group_name='rg', rcf=rcf)
     self.assertEqual(res_utils.api_version, "2016-01-01")