예제 #1
0
    def testJson(self):
        """Load in a json string"""
        s = ('{'
             '"name": "test_job", '
             '"range": "1-10", '
             '"layers": [{'
             '"name": "layer_1", '
             '"module": "outline.modules.shell.Shell", '
             '"env": {"LAYER_KEY1": "LAYER_VALUE1"}, '
             '"command": ["/bin/ls"]'
             '}]'
             '}')

        ol = outline.load_json(s)
        self.assertEqual('test_job', ol.get_name())
        self.assertEqual('1-10', ol.get_frame_range())
        self.assertEqual('LAYER_VALUE1',
                         ol.get_layer('layer_1').get_env('LAYER_KEY1'))

        ol.get_layer('layer_1').set_env('LAYER_KEY2', 'LAYER_VALUE2')

        l = outline.cuerun.OutlineLauncher(ol)
        root = Et.fromstring(l.serialize())
        env1 = root.find('job/layers/layer/env/key[@name="LAYER_KEY1"]')
        self.assertEqual('LAYER_VALUE1', env1.text)
        env2 = root.find('job/layers/layer/env/key[@name="LAYER_KEY2"]')
        self.assertEqual('LAYER_VALUE2', env2.text)
예제 #2
0
    def testJson(self):
        """Load in a json stirng"""
        s = str('{"name": "test_job", "range": "1-10", "layers": \
[{"name": "layer_1", "module": "outline.modules.shell.Shell", "command": ["/bin/ls"]}]}')

        ol = load_json(s)
        self.assertEquals("test_job", ol.get_name())
        self.assertEquals("1-10", ol.get_frame_range())
예제 #3
0
파일: json_test.py 프로젝트: yazici/OpenCue
    def testJsonFile(self, systemMock):
        """Load JSON from a file"""
        with open(os.path.join(JSON_DIR, 'shell.outline')) as fp:
            ol = load_json(fp.read())
        with TemporarySessionDirectory():
            ol.setup()
            ol.get_layer('shell_layer').execute('1000')

            systemMock.assert_has_calls([mock.call(['/bin/ls'], frame=1000)])
예제 #4
0
    def testJsonFile(self, systemMock):
        """Load JSON from a file"""
        with open(os.path.join(JSON_DIR, 'shell.outline')) as fp:
            ol = outline.load_json(fp.read())
        with test_utils.TemporarySessionDirectory():
            ol.setup()
            layer = ol.get_layer('shell_layer')
            self.assertEqual('LAYER_VALUE', layer.get_env('LAYER_KEY'))
            layer.execute('1000')

            systemMock.assert_has_calls([mock.call(['/bin/ls'], frame=1000)])
            self.assertEqual('LAYER_VALUE', os.environ['LAYER_KEY'])
예제 #5
0
파일: json_test.py 프로젝트: yazici/OpenCue
    def testJson(self):
        """Load in a json string"""
        s = ('{'
                 '"name": "test_job", '
                 '"range": "1-10", '
                 '"layers": [{'
                    '"name": "layer_1", '
                    '"module": "outline.modules.shell.Shell", '
                    '"command": ["/bin/ls"]'
                 '}]'
             '}')

        ol = load_json(s)
        self.assertEquals('test_job', ol.get_name())
        self.assertEquals('1-10', ol.get_frame_range())
예제 #6
0
 def testJsonFile(self):
     ""
     ol = load_json(open("json/shell.outline").read())
     ol.setup()
     ol.get_layer("shell_layer").execute("1000")
예제 #7
0
 def testFacility(self):
     """Test facility from JSON"""
     with open(os.path.join(JSON_DIR, 'facility.json')) as fp:
         ol = outline.load_json(fp.read())
         self.assertEqual('test_facility', ol.get_facility())