コード例 #1
0
ファイル: test_import_tasks.py プロジェクト: wangpiju/nccuTEG
    def test_it_creates_the_new_tasks(self, create):
        project = ProjectFactory.create()
        form_data = {'type': 'csv', 'csv_url': 'http://google.es'}

        import_tasks(project.id, **form_data)

        create.assert_called_once_with(task_repo, project.id, **form_data)
コード例 #2
0
ファイル: test_import_tasks.py プロジェクト: Skytim/pybossa
    def test_it_creates_the_new_tasks(self, create):
        project = ProjectFactory.create()
        form_data = {'type': 'csv', 'csv_url': 'http://google.es'}

        import_tasks(project.id, **form_data)

        create.assert_called_once_with(task_repo, project.id, **form_data)
コード例 #3
0
    def test_it_creates_the_new_tasks(self, create):
        project = ProjectFactory.create()
        form_data = {"type": "csv", "csv_url": "http://google.es"}

        import_tasks(project.id, **form_data)

        create.assert_called_once_with(task_repo, project.id, **form_data)
コード例 #4
0
ファイル: test_import_tasks.py プロジェクト: Skytim/pybossa
    def test_sends_email_to_user_with_result_on_success(self, create, send_mail):
        create.return_value = '1 new task was imported successfully'
        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!\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, **form_data)

        send_mail.assert_called_once_with(email_data)
コード例 #5
0
ファイル: test_import_tasks.py プロジェクト: pkdevbox/pybossa
    def test_sends_email_to_user_with_result_on_success(self, create, send_mail):
        create.return_value = '1 new task was imported successfully'
        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!\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, **form_data)

        send_mail.assert_called_once_with(email_data)
コード例 #6
0
ファイル: test_import_tasks.py プロジェクト: lsuttle/pybossa
    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
コード例 #7
0
ファイル: test_import_tasks.py プロジェクト: lsuttle/pybossa
    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)
コード例 #8
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, from_auto=False, **form_data)
        autoimporter = project.get_autoimporter()

        assert autoimporter.get('last_import_meta') == None, autoimporter