Add test_vim_types_success
[multicloud/framework.git] / multivimbroker / multivimbroker / tests / test_vim_types.py
1 # Copyright (c) 2017-2018 VMware, Inc.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #       http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
11 import mock
12 import unittest
13
14 from rest_framework.views import status
15
16 from multivimbroker.forwarder.views import VIMTypes
17
18
19 class TestUrls(unittest.TestCase):
20     def setUp(self):
21         self.view = VIMTypes()
22
23     def test_vim_types_success(self):
24         resp = self.view.get(mock.Mock())
25         expect_body = [
26             {
27                 'vim_type': u'openstack',
28                 'versions': [u'ocata', u'titanium_cloud']
29             },
30             {
31                 'vim_type': u'vmware',
32                 'versions': [u'4.0']
33             }
34         ]
35         self.assertEqual(status.HTTP_200_OK, resp.status_code)
36         self.assertEqual(expect_body, resp.data)