

def test_upload_no_write_permission(self):
    ' Upload without write permission returns 403 '
    self.params = {
        ':action': 'file_upload',
    }
    (name, version, content) = ('foo', 'bar', MagicMock())
    content.filename = 'foo-1.2.tar.gz'
    self.request.access.has_permission.return_value = False
    response = upload(self.request, content, name, version)
    self.assertEqual(response, self.request.forbid())

dataset/ETHPy150Open mathcamp/pypicloud/tests/test_simple.py TestSimple.test_upload_no_write_permission/original