"""
Test harness for smp.py
"""
import sys
import os
sys.path.append('/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib')
os.environ['PATH'] = '/Library/Frameworks/Python.framework/Versions/3.7/bin:' + os.environ['PATH']

import cannr
import smp

# Test openProcess by opening a Flask process
def test_openProcess1():
    
    return smp.openProcess(
        {"processInfo": "processInfo"},
        ['python', '/Users/ptendick/open-source-workspace/cannr Image/test/flaskSample.py', '5000', '1'])

# Test openProcess by opening a Plumber process
def test_openProcess2():
    
    return smp.openProcess(
        {"processInfo": "processInfo"},
        ['Rscript', '--vanilla', '/Users/ptendick/open-source-workspace/cannr Image/source/cannr/runApp.R', 
            '/Users/ptendick/open-source-workspace/cannr Image/test/hello.R', '5001', '2'])

# Test countPorts
def test_countPorts():
    
    projectFilePath = '/Users/ptendick/open-source-workspace/MyRTAM Service/working/project1/project.json'
    project = cannr.readJSONFile(projectFilePath)
    
    return smp.countPorts(project)

[((6, 0, 6, 85), 'sys.path.append', 'sys.path.append', ({(6, 16, 6, 84): '"""/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib"""'}, {}), "(\n    '/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib')", False, 'import sys\n'), ((15, 11, 17, 105), 'smp.openProcess', 'smp.openProcess', ({(16, 8, 16, 38): "{'processInfo': 'processInfo'}", (17, 8, 17, 104): "['python',\n    '/Users/ptendick/open-source-workspace/cannr Image/test/flaskSample.py',\n    '5000', '1']"}, {}), "({'processInfo': 'processInfo'}, ['python',\n    '/Users/ptendick/open-source-workspace/cannr Image/test/flaskSample.py',\n    '5000', '1'])", False, 'import smp\n'), ((22, 11, 25, 91), 'smp.openProcess', 'smp.openProcess', ({(23, 8, 23, 38): "{'processInfo': 'processInfo'}", (24, 8, 25, 90): "['Rscript', '--vanilla',\n    '/Users/ptendick/open-source-workspace/cannr Image/source/cannr/runApp.R',\n    '/Users/ptendick/open-source-workspace/cannr Image/test/hello.R',\n    '5001', '2']"}, {}), "({'processInfo': 'processInfo'}, ['Rscript', '--vanilla',\n    '/Users/ptendick/open-source-workspace/cannr Image/source/cannr/runApp.R',\n    '/Users/ptendick/open-source-workspace/cannr Image/test/hello.R',\n    '5001', '2'])", False, 'import smp\n'), ((31, 14, 31, 49), 'cannr.readJSONFile', 'cannr.readJSONFile', ({(31, 33, 31, 48): 'projectFilePath'}, {}), '(projectFilePath)', False, 'import cannr\n'), ((33, 11, 33, 34), 'smp.countPorts', 'smp.countPorts', ({(33, 26, 33, 33): 'project'}, {}), '(project)', False, 'import smp\n')]