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

# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END

import time
import json

import asyncpg
import http.client
import pytest
import asyncio

__author__ = "<NAME>"
__copyright__ = "Copyright (c) 2017 OSIsoft, LLC"
__license__ = "Apache 2.0"
__version__ = "${VERSION}"

# Module attributes
__DB_NAME = "foglamp"
BASE_URL = 'localhost:8082'
headers = {"Content-Type": 'application/json'}

test_data = {'key': 'TESTAPI', 'description': 'RESTAPI Test Config',
              'value': {'item1': {'description': 'desc', 'type': 'string', 'default': 'def'}}}
pytestmark = pytest.mark.asyncio


async def add_master_data():
    conn = await asyncpg.connect(database=__DB_NAME)
    await conn.execute('''DELETE from foglamp.configuration WHERE key IN ($1)''', test_data['key'])
    await conn.execute("""INSERT INTO foglamp.configuration(key, description, value) VALUES($1, $2, $3);""",
                       test_data['key'], test_data['description'], json.dumps(test_data['value']))
    await conn.close()


async def delete_master_data():
    conn = await asyncpg.connect(database=__DB_NAME)
    await conn.execute('''DELETE from foglamp.configuration WHERE key IN ($1)''', test_data['key'])
    await conn.close()

@pytest.allure.feature("api")
@pytest.allure.story("configuration")
class TestConfigMgr:
    @classmethod
    def setup_class(cls):
        asyncio.get_event_loop().run_until_complete(add_master_data())
        from subprocess import call
        call(["foglamp", "start"])
        time.sleep(2)

    @classmethod
    def teardown_class(cls):
        from subprocess import call
        call(["foglamp", "stop"])
        asyncio.get_event_loop().run_until_complete(delete_master_data())

    def setup_method(self, method):
        pass

    def teardown_method(self, method):
        pass
<commit_msg>Increase waitime after foglamp start<commit_after># -*- coding: utf-8 -*-

# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END

import time
import json

import asyncpg
import http.client
import pytest
import asyncio

__author__ = "<NAME>"
__copyright__ = "Copyright (c) 2017 OSIsoft, LLC"
__license__ = "Apache 2.0"
__version__ = "${VERSION}"

# Module attributes
__DB_NAME = "foglamp"
BASE_URL = 'localhost:8082'
headers = {"Content-Type": 'application/json'}

test_data = {'key': 'TESTAPI', 'description': 'RESTAPI Test Config',
              'value': {'item1': {'description': 'desc', 'type': 'string', 'default': 'def'}}}
pytestmark = pytest.mark.asyncio


async def add_master_data():
    conn = await asyncpg.connect(database=__DB_NAME)
    await conn.execute('''DELETE from foglamp.configuration WHERE key IN ($1)''', test_data['key'])
    await conn.execute("""INSERT INTO foglamp.configuration(key, description, value) VALUES($1, $2, $3);""",
                       test_data['key'], test_data['description'], json.dumps(test_data['value']))
    await conn.close()


async def delete_master_data():
    conn = await asyncpg.connect(database=__DB_NAME)
    await conn.execute('''DELETE from foglamp.configuration WHERE key IN ($1)''', test_data['key'])
    await conn.close()

@pytest.allure.feature("api")
@pytest.allure.story("configuration")
class TestConfigMgr:
    @classmethod
    def setup_class(cls):
        asyncio.get_event_loop().run_until_complete(add_master_data())
        from subprocess import call
        call(["foglamp", "start"])
        time.sleep(4)

    @classmethod
    def teardown_class(cls):
        from subprocess import call
        call(["foglamp", "stop"])
        asyncio.get_event_loop().run_until_complete(delete_master_data())

    def setup_method(self, method):
        pass

    def teardown_method(self, method):
        pass

{'fraction_non_alphanumeric': 0.1452513966480447, 'fraction_numerical': 0.009577015163607342, 'mean_word_length': 4.115646258503402, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '1453079', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1210, 'n_words': 278}