<commit_before># -*- coding: utf-8 -*-

"""
    tests.apiserver
    ~~~~~~~~~~~~

    Tests cobra.api

    :author:    40huo <<EMAIL>>
    :homepage:  https://github.com/wufeifei/cobra
    :license:   MIT, see LICENSE for more details.
    :copyright: Copyright (c) 2017 Feei. All rights reserved
"""

import requests
import json
import multiprocessing
import time
import os
import shutil
import socket
from cobra.config import project_directory
from cobra.api import start

p = multiprocessing.Process(target=start, args=('127.0.0.1', 5000, False))
p.start()
time.sleep(1)

config_path = os.path.join(project_directory, 'config')
template_path = os.path.join(project_directory, 'config.template')
shutil.copyfile(template_path, config_path)


def test_add_job():
    url = "http://127.0.0.1:5000/api/add"
    post_data = {
        "key": "your_secret_key",
        "target": ["https://github.com/shadowsocks/shadowsocks.git"],
    }<commit_msg>refine test case for API<commit_after># -*- coding: utf-8 -*-

"""
    tests.apiserver
    ~~~~~~~~~~~~

    Tests cobra.api

    :author:    40huo <<EMAIL>>
    :homepage:  https://github.com/wufeifei/cobra
    :license:   MIT, see LICENSE for more details.
    :copyright: Copyright (c) 2017 Feei. All rights reserved
"""

import requests
import json
import multiprocessing
import time
import os
import shutil
import socket
from cobra.config import project_directory
from cobra.api import start

p = multiprocessing.Process(target=start, args=('127.0.0.1', 5000, False))
p.start()
time.sleep(1)

config_path = os.path.join(project_directory, 'config')
template_path = os.path.join(project_directory, 'config.template')
shutil.copyfile(template_path, config_path)


def test_add_job():
    url = "http://127.0.0.1:5000/api/add"
    post_data = {
        "key": "your_secret_key",
        "target": ["tests/vulnerabilities"],
    }
{'fraction_non_alphanumeric': 0.14498933901918976, 'fraction_numerical': 0.029850746268656716, 'mean_word_length': 3.8376288659793816, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3360050', 'n_tokens_mistral': 673, 'n_tokens_neox': 631, 'n_words': 148}