def main():
    client = oval_graph.client.client(sys.argv[1:])
    rules = client.search_rules_id()
    if len(rules) > 1:
        answers = client.run_gui_and_return_answers()
        if answers is None:
            print(
                "You haven't got installed inquirer lib. "
                "Please copy id rule with you want use and put it in command")
        else:
            client.prepare_data(answers)
    else:
        client.prepare_data({'rules': [rules[0]['id_rule']]})
Ejemplo n.º 2
0
def test_search_rules_with_regex():
    src = 'test_data/ssg-fedora-ds-arf.xml'
    regex = r'_package_\w+_removed'
    client = get_client(src, regex)
    assert len(client.search_rules_id()) == 2
Ejemplo n.º 3
0
def test_find_not_selected_rule():
    rule = 'xccdf_org.ssgproject.content_rule_ntpd_specify_remote_server'
    src = 'test_data/ssg-fedora-ds-arf.xml'
    client = get_client(src, rule)
    with pytest.raises(Exception, match=rule):
        assert client.search_rules_id()
Ejemplo n.º 4
0
def test_find_does_not_exist_rule():
    rule = 'random_rule_which_doest_exist'
    src = 'test_data/ssg-fedora-ds-arf.xml'
    client = get_client(src, rule)
    with pytest.raises(Exception, match="err- 404 rule not found!"):
        assert client.search_rules_id()
Ejemplo n.º 5
0
def test_search_rules_id_on_web_browser():
    src = 'test_data/ssg-fedora-ds-arf.xml'
    part_of_id_rule = 'xccdf_org.ssgproject.'
    client = get_client_on_web_browser(src, part_of_id_rule)
    assert len(client.search_rules_id()) == 184