diff options
author | 2018-04-09 10:31:19 +0800 | |
---|---|---|
committer | 2018-04-09 10:31:47 +0800 | |
commit | 06468b4f150640bcef9f103c42941ce04c48294f (patch) | |
tree | 70deb3c9e30a7de9f9e4052e1895ce22fdcea4c4 /vio | |
parent | 69987d22b987e344f6dedada64662766c13b236d (diff) |
Add fake get flavor list test
Change-Id: Idda2cbc5e93bc98cda5985445aefe8d108056ad6
Issue-ID: MULTICLOUD-199
Signed-off-by: Bin Sun <bins@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio/tests/test_fake_nova_view.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/vio/vio/tests/test_fake_nova_view.py b/vio/vio/tests/test_fake_nova_view.py index eea01d0..d9a8149 100644 --- a/vio/vio/tests/test_fake_nova_view.py +++ b/vio/vio/tests/test_fake_nova_view.py @@ -58,7 +58,7 @@ class TestFakeNovaHypervisors(unittest.TestCase): self.view = views.FakeNovaHypervisors() @mock.patch.object(fakeResponse, "get_oshypervisor") - def test_get_server(self, mock_get_oshypervisor): + def test_get_hypervisor(self, mock_get_oshypervisor): req = mock.Mock() req.META = { "HTTP_X_AUTH_TOKEN": Token @@ -76,7 +76,7 @@ class TestFakeNovaAggregate(unittest.TestCase): self.view = views.FakeNovaAggregate() @mock.patch.object(fakeResponse, "get_osaggregates") - def test_get_server(self, mock_get_osaggregates): + def test_get_aggregate(self, mock_get_osaggregates): req = mock.Mock() req.META = { "HTTP_X_AUTH_TOKEN": Token @@ -94,7 +94,7 @@ class TestFakeNovaServerDetail(unittest.TestCase): self.view = views.FakeNovaServerDetail() @mock.patch.object(fakeResponse, "get_serverdetail") - def test_get_server(self, mock_get_serverdetail): + def test_get_server_detail(self, mock_get_serverdetail): req = mock.Mock() req.META = { "HTTP_X_AUTH_TOKEN": Token @@ -112,7 +112,7 @@ class TestFakeFlavorDetail(unittest.TestCase): self.view = views.FakeFlavorDetail() @mock.patch.object(fakeResponse, "get_flavors") - def test_get_server(self, mock_get_flavors): + def test_get_flavor_detail(self, mock_get_flavors): req = mock.Mock() req.META = { "HTTP_X_AUTH_TOKEN": Token @@ -122,3 +122,21 @@ class TestFakeFlavorDetail(unittest.TestCase): } resp = self.view.get(req, "abcd", "1234") self.assertEqual(200, resp.status_code) + + +class TestFakeFlavorList(unittest.TestCase): + + def setUp(self): + self.view = views.FakeFlavorList() + + @mock.patch.object(fakeResponse, "list_flavors") + def test_get_flavor_list(self, mock_list_flavors): + req = mock.Mock() + req.META = { + "HTTP_X_AUTH_TOKEN": Token + } + mock_list_flavors.return_value = { + "flavors": "1234abcd" + } + resp = self.view.get(req, "abcd") + self.assertEqual(200, resp.status_code) |