def root_setup(): service_manager_setup.write_service( name='sysmon', root_directory='/opt/infra-python', tool='infra.services.sysmon', args=['--interval', '60']) return 0
def test_write_service(self): self.assertEquals(0, root_setup.root_setup()) root_setup.write_service('foo', 'bar', 'baz', [1, 2]) path = os.path.join(root_setup.SERVICES_DIRECTORY, 'foo.json') contents = open(path).read() self.assertEquals({ 'name': 'foo', 'root_directory': 'bar', 'tool': 'baz', 'args': [1, 2], }, json.loads(contents))