From 06468b4f150640bcef9f103c42941ce04c48294f Mon Sep 17 00:00:00 2001 From: Bin Sun Date: Mon, 9 Apr 2018 10:31:19 +0800 Subject: Add fake get flavor list test Change-Id: Idda2cbc5e93bc98cda5985445aefe8d108056ad6 Issue-ID: MULTICLOUD-199 Signed-off-by: Bin Sun --- vio/vio/tests/test_fake_nova_view.py | 26 ++++++++++++++++++++++---- 1 file 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) -- cgit 1.2.3-korg From ce1c7377566ef9f9626e0fc8405f424911bca4fc Mon Sep 17 00:00:00 2001 From: Bin Sun Date: Mon, 9 Apr 2018 10:39:16 +0800 Subject: Add fake capacity test Change-Id: Ice945e3d21de529cd7ffa5719a4f4b99d394def5 Issue-ID: MULTICLOUD-199 Signed-off-by: Bin Sun --- vio/vio/tests/test_fake_nova_view.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vio/vio/tests/test_fake_nova_view.py b/vio/vio/tests/test_fake_nova_view.py index d9a8149..c1c725d 100644 --- a/vio/vio/tests/test_fake_nova_view.py +++ b/vio/vio/tests/test_fake_nova_view.py @@ -140,3 +140,13 @@ class TestFakeFlavorList(unittest.TestCase): } resp = self.view.get(req, "abcd") self.assertEqual(200, resp.status_code) + + +class TestFakeCapacity(unittest.TestCase): + + def setUp(self): + self.view = views.FakeCapacity() + + def test_get_capacity(self): + resp = self.view.post(mock.Mock()) + self.assertEqual(200, resp.status_code) -- cgit 1.2.3-korg