<commit_before>import time
from pnc_cli import utils
from pnc_cli.swagger_client.apis.buildconfigurations_api import BuildconfigurationsApi
from pnc_cli.swagger_client.apis.runningbuildrecords_api import RunningbuildrecordsApi

configs_api = BuildconfigurationsApi(utils.get_api_client())
running_api = RunningbuildrecordsApi(utils.get_api_client())


def test_get_all():
    # start a build so that a build is running
    # need to run a legitimate build, create a buildconfiguration that will start running
    configs_api.trigger(id=1)
    running_builds = running_api.get_all(page_size=1000000).content
    time.sleep(5)
    assert running_builds is not None


def test_get_specific():
    #same as above
    configs_api.trigger(id=1)
    running_build = running_api.get_specific(id=1)
    time.sleep(5)
    assert running_build is not None<commit_msg>fix runningbuilds API tests to pass.<commit_after>import time

import pytest

from pnc_cli import buildconfigurations
from pnc_cli import utils
from test import testutils
from pnc_cli.swagger_client.apis.buildconfigurations_api import BuildconfigurationsApi
from pnc_cli.swagger_client.apis.runningbuildrecords_api import RunningbuildrecordsApi


configs_api = BuildconfigurationsApi(utils.get_api_client())
running_api = RunningbuildrecordsApi(utils.get_api_client())


@pytest.fixture(scope='function')
def new_config(request):
    created_bc = configs_api.create_new(
        body=buildconfigurations.create_build_conf_object(name=testutils.gen_random_name(),
                                                          project_id=1,
                                                          environment_id=1,
                                                          build_status="UNKNOWN",
                                                          build_script='mvn clean install',
                                                          product_version_ids=[1],
                                                          scm_repo_url='https://github.com/thauser/simple-maven-build-pnc.git')).content

    def teardown():
        existing = [x.id for x in configs_api.get_all(page_size=10000000).content]
        if created_bc.id in existing:
            configs_api.delete_specific(id=created_bc.id)

    request.addfinalizer(teardown)
    return created_bc


def test_get_all(new_config):
    # start a build so that a build is running
    # need to run a legitimate build, create a buildconfiguration that will start running
    configs_api.trigger(id=new_config.id, rebuild_all=False)
    running_builds = running_api.get_all(page_size=1000).content
    assert running_builds is not None


def test_get_specific(new_config):
    # same as above
    triggered_build = configs_api.trigger(id=new_config.id).content
    running_build = running_api.get_specific(id=triggered_build.id)
    assert running_build is not None
{'fraction_non_alphanumeric': 0.06560222145088511, 'fraction_numerical': 0.009371745921555015, 'mean_word_length': 2.8893387314439947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4812574', 'n_tokens_mistral': 805, 'n_tokens_neox': 788, 'n_words': 174}