def test_create_issue(web_tests_fixture):
    main_page, created_issues_list = web_tests_fixture

    summary = "Oleg " + get_time_stamp()
    issue_type = "Bug"
    main_page.create_issue(project=PROJECT_KEY,
                           issue_type=issue_type,
                           summary=summary)
    issue_id = main_page.get_created_issue_id()
    created_issues_list.append(issue_id)

    # validate created issue
    main_page.open_issue_by_id(issue_id)
    assert main_page.get_issue_summary() == summary
Пример #2
0
def created_dummy_issue(jira_api_session_fixture, api_issue_fixture,
                        created_issues):
    api_session, jira_session = jira_api_session_fixture

    # create an issue
    summary = "Oleg " + get_time_stamp()
    api_issue = ApiIssue(jira_session, PROJECT_KEY, BUG_ISSUE_TYPE_KEY,
                         summary)
    api_issue_fixture.set(api_issue)
    r = api_issue.create_issue()
    assert HTTPStatus.CREATED == r.status_code
    created_issues.append(r.json()["id"])
    api_issue.set_key(r.json()["key"])

    return api_issue
Пример #3
0
def test_create_issue(jira_tests_fixture, api_issue_fixture, created_issues):
    api_session, jira_session = jira_tests_fixture

    # create issue
    summary = "Oleg " + get_time_stamp()
    api_issue = ApiIssue(jira_session, PROJECT_KEY, BUG_ISSUE_TYPE_KEY,
                         summary)
    api_issue_fixture.set(api_issue)
    r = api_issue.create_issue()
    assert HTTPStatus.CREATED == r.status_code
    created_issues.append(r.json()["id"])

    # validate the issue is really created
    r = api_issue.get_issue(created_issues[-1])
    assert HTTPStatus.OK == r.status_code
    assert summary == r.json()["fields"]["summary"]
Пример #4
0
def test_create_issue_with_missing_required_fields(jira_tests_fixture,
                                                   api_issue_fixture):
    api_session, jira_session = jira_tests_fixture

    api_issue = ApiIssue(jira_session, PROJECT_KEY, BUG_ISSUE_TYPE_KEY,
                         "Oleg " + get_time_stamp())
    api_issue_fixture.set(api_issue)

    # remove a required field from body
    body_missing_fields = api_issue.get_body()
    del body_missing_fields["fields"]["summary"]

    # try to create issue
    r = api_issue.create_issue()
    assert HTTPStatus.BAD_REQUEST == r.status_code
    assert MISSING_SUMMARY_FIELD_ERROR_TEXT == r.json()["errors"]["summary"]
Пример #5
0
def created_issues_summaries(jira_api_session_fixture, api_issue_fixture,
                             created_issues):
    api_session, jira_session = jira_api_session_fixture

    created_issues_summaries = []
    for issue_num in range(MAX_ISSUES_TO_CREATE):
        summary = "Oleg " + get_time_stamp()
        api_issue = ApiIssue(jira_session, PROJECT_KEY, BUG_ISSUE_TYPE_KEY,
                             summary)
        api_issue_fixture.set(api_issue)
        r = api_issue.create_issue()
        assert HTTPStatus.CREATED == r.status_code
        created_issues.append(r.json()["id"])
        created_issues_summaries.append(summary)

    return created_issues_summaries
Пример #6
0
if __name__ == "__main__":
    username = os.getenv("USER")
    best_scores = {dset: {"username": "******", "score": 0} for dset in dsets}
    best_scores_filename = osp.join(osp.dirname(__file__), "..",
                                    "best_scores.out")
    if osp.exists(best_scores_filename):
        best_scores = get_best_scores(best_scores_filename)
    old_score = 0

    while True:
        score = 0
        for dset in dsets:
            fname_high_score = sorted(
                glob(
                    osp.join(osp.dirname(__file__), "..", "out",
                             "%s*.out" % dset)))[-1]
            score = int(
                osp.basename(fname_high_score)[len(dset) + 1:].split("_")[0])
            if score > best_scores[dset]["score"]:
                best_scores[dset] = {"score": score, "username": username}
                copy_out_to_best(fname_high_score)
                write_best_scores(best_scores_filename, best_scores)
        score = sum(best_scores[dset]["score"] for dset in dsets)
        if score > old_score:
            print(
                get_time_stamp(with_date=False, with_delims=True),
                num_with_underscores(score),
            )
            old_score = score
        sleep(10)