Ejemplo n.º 1
0
    def test_delete_file_wo_file(self):
        self.mock.StubOutWithMock(FieldFile, 'delete')

        item = PodcastItem()

        self.mock.ReplayAll()
        item.delete_file()
        self.mock.VerifyAll()
Ejemplo n.º 2
0
    def test_delete_file_wo_file(self):
        self.mock.StubOutWithMock(FieldFile, 'delete')

        item = PodcastItem()

        self.mock.ReplayAll()
        item.delete_file()
        self.mock.VerifyAll()
Ejemplo n.º 3
0
    def test_cleanup_item_delete_signal(self):
        self.mock.StubOutWithMock(PodcastItem, 'delete_file')
        PodcastItem.delete_file()
        item = PodcastItem.objects.create(
            channel=PodcastChannel.objects.create(), guid='/ep123.mp3',
            url='http://example.com/ep123.mp3')

        self.mock.ReplayAll()
        item.delete()
        self.mock.VerifyAll()
Ejemplo n.º 4
0
    def test_delete_file(self):
        self.mock.StubOutWithMock(FieldFile, 'delete')
        FieldFile.delete()

        item = PodcastItem(
            file=SimpleUploadedFile('/ep123.txt', 'file contents'))

        self.mock.ReplayAll()
        item.delete_file()
        self.mock.VerifyAll()
Ejemplo n.º 5
0
    def test_delete_file(self):
        self.mock.StubOutWithMock(FieldFile, 'delete')
        FieldFile.delete()

        item = PodcastItem(
            file=SimpleUploadedFile('/ep123.txt', 'file contents'))

        self.mock.ReplayAll()
        item.delete_file()
        self.mock.VerifyAll()
Ejemplo n.º 6
0
    def test_cleanup_item_delete_signal(self):
        self.mock.StubOutWithMock(PodcastItem, 'delete_file')
        PodcastItem.delete_file()
        item = PodcastItem.objects.create(
            channel=PodcastChannel.objects.create(),
            guid='/ep123.mp3',
            url='http://example.com/ep123.mp3')

        self.mock.ReplayAll()
        item.delete()
        self.mock.VerifyAll()
Ejemplo n.º 7
0
    def test_delete(self):
        item = PodcastItem()
        request = RequestFactory().get('')
        self.mock.StubOutWithMock(self.view, 'get_object')
        self.mock.StubOutWithMock(item, 'delete_file')
        self.view.get_object().AndReturn(item)
        item.delete_file()

        self.mock.ReplayAll()
        resp = self.view.delete(request)
        self.mock.VerifyAll()

        self.assertEqual(resp.status_code, 204)
Ejemplo n.º 8
0
    def test_delete(self):
        item = PodcastItem()
        request = RequestFactory().get('')
        self.mock.StubOutWithMock(self.view, 'get_object')
        self.mock.StubOutWithMock(item, 'delete_file')
        self.view.get_object().AndReturn(item)
        item.delete_file()
        
        self.mock.ReplayAll()
        resp = self.view.delete(request)
        self.mock.VerifyAll()

        self.assertEqual(resp.status_code, 204)