diff --git a/requirements.txt b/requirements.txt index a963a8f2..a13f9914 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ networkx==1.9.1 PyYAML==3.11 jsonschema==2.4.0 requests==2.7.0 +mock diff --git a/solar/solar/core/resource.py b/solar/solar/core/resource.py index ea83bdaf..59941f07 100644 --- a/solar/solar/core/resource.py +++ b/solar/solar/core/resource.py @@ -28,6 +28,7 @@ class Resource(object): self.metadata = metadata self.actions = metadata['actions'].keys() if metadata['actions'] else None self.args = {} + for arg_name, arg_value in args.items(): if not self.metadata['input'].get(arg_name): continue @@ -178,6 +179,7 @@ def assign_resources_to_nodes(resources, nodes): signals.connect(created_node, created_resource) + def connect_resources(profile): connections = profile.get('connections', []) graph = ResourcesConnectionGraph(connections, load_all().values()) diff --git a/solar/solar/test/base.py b/solar/solar/test/base.py index 7dfcd82c..5bb526ef 100644 --- a/solar/solar/test/base.py +++ b/solar/solar/test/base.py @@ -4,9 +4,11 @@ import tempfile import unittest import yaml -from solar.core import db from solar.core import resource as xr from solar.core import signals as xs +from solar.interfaces.db import get_db + +db = get_db() class BaseResourceTest(unittest.TestCase): @@ -29,8 +31,4 @@ class BaseResourceTest(unittest.TestCase): return path def create_resource(self, name, src, args): - dst = os.path.join(self.storage_dir, 'rs', name) - os.makedirs(dst) - - return xr.create(name, src, dst, args) - + return xr.create(name, src, args)