def test_get_agent_resource_url(self):
     properties = {
         'cloudify_agent': {
             'disable_requiretty': False,
             'distro': 'Ubuntu',
             'distro_codename': 'trusty'
         }
     }
     ctx = get_remote_context(properties)
     agent_package_url = tasks.get_agent_resource_url(
         ctx, ctx.node.properties['cloudify_agent'], 'agent_package_path')
     self.assertEquals(agent_package_url, AGENT_PACKAGE_URL)
 def test_get_agent_resource_url(self):
     properties = {
         'cloudify_agent': {
             'disable_requiretty': False,
             'distro': 'Ubuntu',
             'distro_codename': 'trusty'
         }
     }
     ctx = get_remote_context(properties)
     agent_package_url = tasks.get_agent_resource_url(
         ctx, ctx.node.properties['cloudify_agent'], 'agent_package_path')
     self.assertEquals(agent_package_url, AGENT_PACKAGE_URL)
    def test_get_agent_resource_url_from_agent_config(self):
        blueprint_id = 'mock_blueprint'
        properties = {
            'cloudify_agent': {
                'user': '******',
                'host': VAGRANT_MACHINE_IP,
                'key': '~/.vagrant.d/insecure_private_key',
                'port': 2222,
                'distro': 'Ubuntu',
                'distro_codename': 'trusty',
                'agent_package_path': 'some-agent.tar.gz'
            }
        }
        ctx = get_remote_context(properties)
        # should be http://localhost:8000/mock_blueprint/some-agent.tar.gz
        path = FILE_SERVER + '/{0}'.format(blueprint_id) + \
            '/' + properties['cloudify_agent']['agent_package_path']

        r = tasks.get_agent_resource_url(
            ctx, ctx.node.properties['cloudify_agent'], 'agent_package_path')
        self.assertEquals(path, r)
    def test_get_agent_resource_url_from_agent_config(self):
        blueprint_id = 'mock_blueprint'
        properties = {
            'cloudify_agent': {
                'user': '******',
                'host': VAGRANT_MACHINE_IP,
                'key': '~/.vagrant.d/insecure_private_key',
                'port': 2222,
                'distro': 'Ubuntu',
                'distro_codename': 'trusty',
                'agent_package_path': 'some-agent.tar.gz'
            }
        }
        ctx = get_remote_context(properties)
        # should be http://localhost:8000/mock_blueprint/some-agent.tar.gz
        path = FILE_SERVER + '/{0}'.format(blueprint_id) + \
            '/' + properties['cloudify_agent']['agent_package_path']

        r = tasks.get_agent_resource_url(ctx,
                                         ctx.node.properties['cloudify_agent'],
                                         'agent_package_path')
        self.assertEquals(path, r)