## class install test

from releasemanager.installer.target import NamedTarget
from releasemanager.tests.mock.resource import MockResource
nt = NamedTarget('test', 'named_target_template')
resource = MockResource('test').data
nt.install(resource, 'http://svn.fake.com/svn/project/trunk; 9999')


## class install test

from releasemanager.installer.releasedaemon import ReleaseInstaller
from releasemanager.tests.mock.resource import MockResource
test_identifier = 'http://svn.fake.com/svn/project/trunk; 9999'
environment = 'test'
target = 'template'
resource = MockResource('test').data
ri = ReleaseInstaller('release_installer_template')
ri.install(environment, target, resource, test_identifier)
environment = 'broken'
ri.install(environment, target, resource, test_identifier)


## class build test

from releasemanager.builder import ReleaseBuilder
rb = ReleaseBuilder("release_builder_template")
rb.build(trunk=True)

## class build test

from releasemanager.builder.buildhost import BuildHost
bh = BuildHost('build_host_template')
status, resource = bh.build('template', trunk=True)
status
bh.report()


## svc build test

from xmlrpclib import ServerProxy
url = "http://localhost:9999"
s = ServerProxy(url)
credentials = dict(username = 'relman_test', password = 'relman_test')
request_data = dict(project = 'template', trunk=True)
status, resource = s.build(credentials, request_data)
open("/tmp/out/resource.zip", 'w').write(resource.data)

## svc test relman

from xmlrpclib import ServerProxy
relman_url = "http://localhost:10000"
relman = ServerProxy(relman_url)
credentials = dict(username = 'relman_test', password = 'relman_test')
request_data = dict(project = 'template', trunk=True, action="install", env="test")
trans_id = relman.request_action(credentials, request_data)
relman.query_transaction(trans_id)
