Exemple #1
0
    def test_it_does_not_add_import_metadata_to_autoimporter_if_is_import_job(self, create, send_mail):
        create.return_value = ImportReport(message='1 new task was imported successfully', metadata="meta", total=1)
        form_data = {'type': 'csv', 'csv_url': 'http://google.es'}
        project = ProjectFactory.create(info=dict(autoimporter=form_data))
        subject = 'Tasks Import to your project %s' % project.name
        body = 'Hello,\n\n1 new task was imported successfully to your project %s!\n\nAll the best,\nThe PYBOSSA team.' % project.name
        email_data = dict(recipients=[project.owner.email_addr],
                          subject=subject, body=body)

        import_tasks(project.id, 'The Hound', from_auto=False, **form_data)
        autoimporter = project.get_autoimporter()

        assert autoimporter.get('last_import_meta') == None, autoimporter
Exemple #2
0
    def test_sends_email_to_user_with_result_on_success(self, create, send_mail):
        uploader_name = 'Cersei Lannister'
        create.return_value = ImportReport(message='1 new task was imported successfully', metadata=None, total=1)
        project = ProjectFactory.create()
        form_data = {'type': 'csv', 'csv_url': 'http://google.es'}
        subject = 'Tasks Import to your project %s' % project.name
        body = 'Hello,\n\n1 new task was imported successfully to your project %s by %s.\n\nAll the best,\nThe PYBOSSA team.' % (project.name, uploader_name)
        email_data = dict(recipients=[project.owner.email_addr],
                          subject=subject, body=body)

        import_tasks(project.id, uploader_name, **form_data)

        send_mail.assert_called_once_with(email_data)