Пример #1
0
def test_get_dict():
    detection = Detection(examples_path, '.')
    extension = ['php', 'js', 'java']
    type_num = {}
    type_num = detection.get_dict(extension, type_num)
    print(type(type_num))
    assert type_num['php']['blank'] == 0
Пример #2
0
def test_param_xml():
    detection = Detection(examples_path, '.')
    frame_data = {}
    language_data = {}
    tree = detection.rule()
    root = tree.getroot()
    frame_data, language_data = detection.parse_xml(root, frame_data, language_data)
    assert 'WordPress' in frame_data
    assert 'php' in language_data
Пример #3
0
def test_rule():
    detection = Detection(examples_path, '.')
    root = eT.ElementTree(file=examples_path + '/param_xml.xml')
    tree = detection.rule()
    assert type(root) is type(tree)
Пример #4
0
def test_framework():
    detection = Detection(vul_path + 'requirements.txt', '.')
    frame = detection.framework
    assert frame == 'Flask'
Пример #5
0
def test_cloc():
    assert Detection(examples_path, '.').cloc()
Пример #6
0
def test_get_dict():
    detection = Detection(examples_path, '.')
    extension = ['php', 'js', 'java']
    type_num = {}
    type_num = detection.get_dict(extension, type_num)
    assert isinstance(extension, type(type_num.keys()))