コード例 #1
0
    def test_delete(self):
        senlin = resources.SenlinMixin()
        senlin._service = "senlin"
        senlin.user = mock.MagicMock()
        senlin._resource = "some_resources"
        senlin.raw_resource = {"id": "TEST_ID"}
        senlin.user.senlin().delete_some_resource.return_value = None

        senlin.delete()
        senlin.user.senlin().delete_some_resource.assert_called_once_with(
            "TEST_ID")
コード例 #2
0
    def test_list(self):
        senlin = resources.SenlinMixin()
        senlin._service = "senlin"
        senlin.user = mock.MagicMock()
        senlin._resource = "some_resources"

        some_resources = [{"name": "resource1"}, {"name": "resource2"}]
        senlin.user.senlin().some_resources.return_value = some_resources

        self.assertEqual(some_resources, senlin.list())
        senlin.user.senlin().some_resources.assert_called_once_with()
コード例 #3
0
 def test__manager(self):
     senlin = resources.SenlinMixin()
     senlin._service = "senlin"
     senlin.user = mock.MagicMock()
     self.assertEqual(senlin.user.senlin.return_value, senlin._manager())
コード例 #4
0
 def test_id(self):
     senlin = resources.SenlinMixin()
     senlin.raw_resource = {"id": "TEST_ID"}
     self.assertEqual("TEST_ID", senlin.id())