コード例 #1
0
def test_cores():
    """ Test the cores function """
    instance = MenuHelper()
    cores = instance.cores('install')
    assert cores[0] == True
    cores = instance.cores('build')
    assert cores[0] == True
    cores = instance.cores('start')
    assert cores[0] == True
    cores = instance.cores('stop')
    assert cores[0] == True
    cores = instance.cores('clean')
    assert cores[0] == True
コード例 #2
0
def test_jobs():
    """ Test the jobs function """
    jobs = Jobs()
    assert isinstance(jobs, tuple)
    path = PathDirs()
    status = path.host_config()
    assert isinstance(status, tuple)
    assert status[0]
    m_helper = MenuHelper()
    status = m_helper.cores('install')
    assert isinstance(status, tuple)
    assert status[0]
    status = m_helper.cores('build')
    assert isinstance(status, tuple)
    assert status[0]
    status = m_helper.cores('start')
    assert isinstance(status, tuple)
    assert status[0]
    status = m_helper.api_action.add(
        'https://github.com/cyberreboot/vent-plugins',
        tools=[('tcpdump_hex_parser', ''), ('gpu_example', '')])
    assert isinstance(status, tuple)
    assert status[0]
    # run test job
    with open('/opt/vent_files/foo.matrix', 'w') as f:
        f.write('24,23\n10,22')
    pcap = 'https://s3.amazonaws.com/tcpreplay-pcap-files/test.pcap'
    r = requests.get(pcap, stream=True)

    if r.status_code == 200:
        with open('/opt/vent_files/foo.pcap', 'wb') as f:
            r.raw.decode_content = True
            shutil.copyfileobj(r.raw, f)
    services = Services(True)
    assert isinstance(services, list)
    jobs = Jobs()
    assert isinstance(jobs, tuple)