Beispiel #1
0
 def handle(self, request, data):
     try:
         api.chase_delete_container(request, data['container_name'])
     except ContainerNotEmpty, e:
         messages.error(request,
                        _('Unable to delete non-empty container: %s') %
                        data['container_name'])
         LOG.exception('Unable to delete container "%s".  Exception: "%s"' %
                   (data['container_name'], str(e)))
Beispiel #2
0
 def handle(self, request, data):
     try:
         api.chase_delete_container(request, data['container_name'])
     except ContainerNotEmpty, e:
         messages.error(
             request,
             _('Unable to delete non-empty container: %s') %
             data['container_name'])
         LOG.exception('Unable to delete container "%s".  Exception: "%s"' %
                       (data['container_name'], str(e)))
Beispiel #3
0
    def test_delete_container(self):
        formData = {'container_name': 'containerName',
                    'method': 'DeleteContainer'}

        self.mox.StubOutWithMock(api, 'chase_delete_container')
        api.chase_delete_container(IsA(http.HttpRequest),
                                   'containerName')

        self.mox.ReplayAll()

        res = self.client.post(CONTAINER_INDEX_URL, formData)

        self.assertRedirectsNoFollow(res, CONTAINER_INDEX_URL)
Beispiel #4
0
    def test_delete_container(self):
        formData = {
            'container_name': 'containerName',
            'method': 'DeleteContainer'
        }

        self.mox.StubOutWithMock(api, 'chase_delete_container')
        api.chase_delete_container(IsA(http.HttpRequest), 'containerName')

        self.mox.ReplayAll()

        res = self.client.post(CONTAINER_INDEX_URL, formData)

        self.assertRedirectsNoFollow(res, CONTAINER_INDEX_URL)
Beispiel #5
0
    def test_delete_container_nonempty(self):
        formData = {'container_name': 'containerName',
                          'method': 'DeleteContainer'}

        exception = ContainerNotEmpty('containerNotEmpty')

        self.mox.StubOutWithMock(api, 'chase_delete_container')
        api.chase_delete_container(
                IsA(http.HttpRequest),
                'containerName').AndRaise(exception)

        self.mox.StubOutWithMock(messages, 'error')

        messages.error(IgnoreArg(), IsA(unicode))

        self.mox.ReplayAll()

        res = self.client.post(CONTAINER_INDEX_URL, formData)

        self.assertRedirectsNoFollow(res, CONTAINER_INDEX_URL)
Beispiel #6
0
    def test_delete_container_nonempty(self):
        formData = {
            'container_name': 'containerName',
            'method': 'DeleteContainer'
        }

        exception = ContainerNotEmpty('containerNotEmpty')

        self.mox.StubOutWithMock(api, 'chase_delete_container')
        api.chase_delete_container(IsA(http.HttpRequest),
                                   'containerName').AndRaise(exception)

        self.mox.StubOutWithMock(messages, 'error')

        messages.error(IgnoreArg(), IsA(unicode))

        self.mox.ReplayAll()

        res = self.client.post(CONTAINER_INDEX_URL, formData)

        self.assertRedirectsNoFollow(res, CONTAINER_INDEX_URL)