# Path: tests/helpers.py
# class BaseTestCase(unittest.TestCase):
#     def shortDescription(self):
#         return None
# 
# class DatabaseMock(Mock):
#     active_sessions = {}
#     endpoints = {}
# 
#     def __init__(self, *args, **kwargs):
#         super(DatabaseMock, self).__init__(*args, **kwargs)
#         self.add = Mock(side_effect=set_primary_key)
# 
#     def get_active_sessions(self, provider_id=None):
#         return self.active_sessions.values()
# 
#     def get_session(self, session_id):
#         return self.active_sessions.get(str(session_id))
# 
#     def get_endpoint(self, endpoint):
#         pass
# 
#     def get_endpoints(self, *args, **kwargs):
#         return self.endpoints.values()
# 
#     @staticmethod
#     def get_last_session_step(session_id):
#         return Mock()
# 
#     def register_provider(self, name, url, platforms):
#         from core.db.models import Provider
#         return Provider(name, url, platforms)
# 
# def wait_for(condition, timeout=10):
#     start = time.time()
#     while not condition() and time.time() - start < timeout:
#         time.sleep(0.1)
# 
#     return condition()
# 
# Path: core/config.py
# def full_path(path_to_config):
# def _import(filename):
# def create_if_not_exist(directory):
#     def update(self, new_values):
# def setup_config(path_to_config):
# class Config(object):


import os
from flask import Flask
from mock import patch, Mock
from tests.helpers import BaseTestCase, DatabaseMock, wait_for
from core.config import config, setup_config
        from vmpool.artifact_collector import ArtifactCollector
            from core.db.models import Session, Endpoint, Provider
        from vmpool.artifact_collector import ArtifactCollector
            from core.db.models import Session, Endpoint, Provider
        from vmpool.artifact_collector import ArtifactCollector
            from core.db.models import Session, Endpoint, Provider
        from vmpool.artifact_collector import ArtifactCollector, Task
        from multiprocessing.pool import AsyncResult
# coding: utf-8





def run_script_mock(script, host):
    yield 200, {}, '{"output": "test text"}'


def failed_run_script_mock(script, host):
    yield 500, {}, ''



# Path: tests/helpers.py
# class BaseTestCase(unittest.TestCase):
#     def shortDescription(self):
#         return None
# 
# class DatabaseMock(Mock):
#     active_sessions = {}
#     endpoints = {}
# 
#     def __init__(self, *args, **kwargs):
#         super(DatabaseMock, self).__init__(*args, **kwargs)
#         self.add = Mock(side_effect=set_primary_key)
# 
#     def get_active_sessions(self, provider_id=None):
#         return self.active_sessions.values()
# 
#     def get_session(self, session_id):
#         return self.active_sessions.get(str(session_id))
# 
#     def get_endpoint(self, endpoint):
#         pass
# 
#     def get_endpoints(self, *args, **kwargs):
#         return self.endpoints.values()
# 
#     @staticmethod
#     def get_last_session_step(session_id):
#         return Mock()
# 
#     def register_provider(self, name, url, platforms):
#         from core.db.models import Provider
#         return Provider(name, url, platforms)
# 
# def wait_for(condition, timeout=10):
#     start = time.time()
#     while not condition() and time.time() - start < timeout:
#         time.sleep(0.1)
# 
#     return condition()
# 
# Path: core/config.py
# def full_path(path_to_config):
# def _import(filename):
# def create_if_not_exist(directory):
#     def update(self, new_values):
# def setup_config(path_to_config):
# class Config(object):


# Path: tests/unit/test_artifact_collector.py
import os
from flask import Flask
from mock import patch, Mock
from tests.helpers import BaseTestCase, DatabaseMock, wait_for
from core.config import config, setup_config
        from vmpool.artifact_collector import ArtifactCollector
            from core.db.models import Session, Endpoint, Provider
        from vmpool.artifact_collector import ArtifactCollector
            from core.db.models import Session, Endpoint, Provider
        from vmpool.artifact_collector import ArtifactCollector
            from core.db.models import Session, Endpoint, Provider
        from vmpool.artifact_collector import ArtifactCollector, Task
        from multiprocessing.pool import AsyncResult

# coding: utf-8





def run_script_mock(script, host):
    yield 200, {}, '{"output": "test text"}'


def failed_run_script_mock(script, host):
    yield 500, {}, ''



class TestArtifactCollector(BaseTestCase):