コード例 #1
0
ファイル: conftest.py プロジェクト: vakila/treeherder
def bugs(mock_bugzilla_api_request):
    from treeherder.etl.bugzilla import BzApiBugProcess
    from treeherder.model.models import Bugscache

    process = BzApiBugProcess()
    process.run()

    return Bugscache.objects.all()
コード例 #2
0
def bugs(mock_bugzilla_api_request):
    from treeherder.etl.bugzilla import BzApiBugProcess
    from treeherder.model.models import Bugscache

    process = BzApiBugProcess()
    process.run()

    return Bugscache.objects.all()
コード例 #3
0
def test_bz_reopen_bugs(request, mock_bugzilla_reopen_request, client,
                        test_job, test_user, bugs):
    """
    Test expected bugs get reopened.
    """
    bug = bugs[0]
    client.force_authenticate(user=test_user)

    incomplete_bugs = [bug for bug in bugs if bug.resolution == "INCOMPLETE"]
    not_incomplete_bugs = [
        bug for bug in bugs if bug.resolution != "INCOMPLETE"
    ]
    for bug in [
            not_incomplete_bugs[0],
            not_incomplete_bugs[2],
            incomplete_bugs[0],
            incomplete_bugs[2],
    ]:
        submit_obj = {
            u"job_id": test_job.id,
            u"bug_id": bug.id,
            u"type": u"manual"
        }

        client.post(
            reverse("bug-job-map-list",
                    kwargs={"project": test_job.repository.name}),
            data=submit_obj,
        )

    process = BzApiBugProcess()
    process.run()

    reopened_bugs = request.config.cache.get('reopened_bugs', None)

    import json

    EXPECTED_REOPEN_ATTEMPTS = {
        'https://thisisnotbugzilla.org/rest/bug/202':
        json.dumps({
            "status": "REOPENED",
            "comment": {
                "body":
                "New failure instance: https://treeherder.mozilla.org/logviewer?job_id=1&repo=test_treeherder_jobs"
            },
            "comment_tags": "treeherder",
        }),
        'https://thisisnotbugzilla.org/rest/bug/404':
        json.dumps({
            "status": "REOPENED",
            "comment": {
                "body":
                "New failure instance: https://treeherder.mozilla.org/logviewer?job_id=1&repo=test_treeherder_jobs"
            },
            "comment_tags": "treeherder",
        }),
    }
    assert reopened_bugs == EXPECTED_REOPEN_ATTEMPTS
コード例 #4
0
def test_bz_api_process(mock_bugzilla_api_request):
    process = BzApiBugProcess()
    process.run()

    # the number of rows inserted should equal to the number of bugs
    assert Bugscache.objects.count() == 17

    # test that a second ingestion of the same bugs doesn't insert new rows
    process.run()
    assert Bugscache.objects.count() == 17
コード例 #5
0
def test_bz_api_process(mock_extract, refdata):
    process = BzApiBugProcess()
    process.run()

    row_data = refdata.dhub.execute(
        proc='refdata_test.selects.test_bugscache',
        return_type='tuple'
    )
    # the number of rows inserted should equal to the number of bugs
    assert len(row_data) == 10

    # test that a second ingestion of the same bugs doesn't insert new rows
    process.run()
    assert len(row_data) == 10
コード例 #6
0
def test_bz_api_process(mock_extract, refdata):
    process = BzApiBugProcess()
    process.run()

    row_data = refdata.dhub.execute(proc='refdata_test.selects.test_bugscache',
                                    return_type='tuple')

    refdata.disconnect()

    # the number of rows inserted should equal to the number of bugs
    assert len(row_data) == 15

    # test that a second ingestion of the same bugs doesn't insert new rows
    process.run()
    assert len(row_data) == 15
コード例 #7
0
def fetch_bugs():
    """
    Run a BzApiBug process
    """
    process = BzApiBugProcess()
    process.run()
コード例 #8
0
 def handle(self, *args, **options):
     process = BzApiBugProcess()
     process.run()
コード例 #9
0
 def handle(self, *args, **options):
     process = BzApiBugProcess()
     process.run()