def test_show_snapshot_instance_not_found(self): mock__view_builder_call = self.mock_object( share_snapshot_instances.instance_view.ViewBuilder, 'detail') fake_exception = exception.ShareSnapshotInstanceNotFound( instance_id='FAKE_SNAPSHOT_INSTANCE_ID') self.mock_object(share_snapshot_instances.db, 'share_snapshot_instance_get', mock.Mock(side_effect=fake_exception)) self.assertRaises(exc.HTTPNotFound, self.controller.show, self.snapshot_instances_req, 'FAKE_SNAPSHOT_INSTANCE_ID') self.assertFalse(mock__view_builder_call.called)
def test_snapshot_instance_not_found(self): # verify response code for exception.ShareSnapshotInstanceNotFound instance_id = 'fake_instance_id' e = exception.ShareSnapshotInstanceNotFound(instance_id=instance_id) self.assertEqual(404, e.code) self.assertIn(instance_id, e.msg)