Beispiel #1
0
 def test_upload(self, mock_get_url, mock_put):
     mock_get_url.return_value = 'http://queen.com/'
     self.attachment.filename = 'hammer-to-fall'
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         self.user,
         self.node,
         path=self.attachment.filename,
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
Beispiel #2
0
 def test_upload_no_file_name(self, mock_get_url, mock_put):
     mock_get_url.return_value = 'http://queen.com/'
     self.attachment.filename = ''
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         self.user,
         self.node,
         path=settings.MISSING_FILE_NAME,
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
Beispiel #3
0
 def test_upload_no_file_name(self, mock_get_url, mock_put):
     mock_get_url.return_value = 'http://queen.com/'
     self.attachment.filename = ''
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         self.user,
         self.node,
         path=settings.MISSING_FILE_NAME,
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
Beispiel #4
0
 def test_upload(self, mock_get_url, mock_put):
     mock_get_url.return_value = 'http://queen.com/'
     self.attachment.filename = 'hammer-to-fall'
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         self.user,
         self.node,
         path=self.attachment.filename,
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
 def test_upload_no_file_name(self, mock_put, mock_get_url):
     mock_get_url.return_value = 'http://queen.com/'
     self.attachment.filename = ''
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         self.node._id,
         'osfstorage',
         _internal=True,
         cookie=self.user.get_or_create_cookie(),
         name=settings.MISSING_FILE_NAME,
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
Beispiel #6
0
 def test_upload_no_file_name(self, mock_put, mock_get_url):
     mock_get_url.return_value = 'http://queen.com/'
     self.attachment.filename = ''
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         self.node._id,
         'osfstorage',
         _internal=True,
         cookie=self.user.get_or_create_cookie(),
         name=settings.MISSING_FILE_NAME,
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
Beispiel #7
0
 def test_upload(self, mock_put, mock_get_url):
     mock_get_url.return_value = 'http://queen.com/'
     self.attachment.filename = 'hammer-to-fall'
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         'upload',
         'osfstorage',
         '/' + self.attachment.filename,
         self.node,
         _internal=True,
         user=self.user,
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
Beispiel #8
0
 def test_upload(self, mock_put, mock_get_url):
     mock_get_url.return_value = 'http://queen.com/'
     self.attachment.filename = 'hammer-to-fall'
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         'upload',
         'osfstorage',
         '/' + self.attachment.filename,
         self.node,
         _internal=True,
         user=self.user,
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
Beispiel #9
0
 def test_upload(self, mock_put, mock_get_url):
     mock_get_url.return_value = 'http://queen.com/'
     file_name = 'hammer-to-fall'
     self.attachment.filename = file_name
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         self.node._id,
         'osfstorage',
         _internal=True,
         base_url=self.node.osfstorage_region.waterbutler_url,
         cookie=self.user.get_or_create_cookie().decode(),
         name=file_name)
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )
 def test_upload(self, mock_put, mock_get_url):
     mock_get_url.return_value = 'http://queen.com/'
     file_name = 'hammer-to-fall'
     self.attachment.filename = file_name
     self.attachment.content_type = 'application/json'
     utils.upload_attachment(self.user, self.node, self.attachment)
     mock_get_url.assert_called_with(
         self.node._id,
         'osfstorage',
         _internal=True,
         base_url=self.node.osfstorage_region.waterbutler_url,
         cookie=self.user.get_or_create_cookie(),
         name=file_name
     )
     mock_put.assert_called_with(
         mock_get_url.return_value,
         data=self.content,
     )