def test_upload_filedata_raises_exception_if_parsing_empty(self, mock_save_file, mock_parse):
        # given
        uploaded_file = Mock()
        uploaded_file.filename = 'filename.csv'

        mock_parse.return_value = []
        # when
        mock_save_file.return_value = True

        # then
        with self.assertRaises(NoItemsGeneratedFromParsingException):
            upload_filedata(uploaded_file)
Example #2
0
    def test_upload_filedata_raises_exception_if_parsing_empty(
            self, mock_save_file, mock_parse):
        # given
        uploaded_file = Mock()
        uploaded_file.filename = 'filename.csv'

        mock_parse.return_value = []
        # when
        mock_save_file.return_value = True

        # then
        with self.assertRaises(NoItemsGeneratedFromParsingException):
            upload_filedata(uploaded_file)
Example #3
0
    def test_upload_filedata_returns_false_if_extension_not_correct(self):
        # given
        uploaded_file = Mock()
        uploaded_file.filename = 'filename.oops'

        # when
        success = upload_filedata(uploaded_file)

        # then
        self.assertFalse(success)
    def test_upload_filedata_returns_false_if_extension_not_correct(self):
        # given
        uploaded_file = Mock()
        uploaded_file.filename = 'filename.oops'

        # when
        success = upload_filedata(uploaded_file)

        # then
        self.assertFalse(success)