def _test(content, execable=False): fullPath = os.path.join(cfg.entitlementDir, 'localhost') open(fullPath, "w").write(content) if execable: os.chmod(fullPath, 0755) else: os.chmod(fullPath, 0644) try: conarycfg.loadEntitlement(cfg.entitlementDir, 'localhost') except errors.ConaryError, err: return str(err)
def _doTest(cfg, server, content, value): fullPath = os.path.join(cfg.entitlementDir, server) open(fullPath, "w").write(content) os.chmod(fullPath, 0644) rc = conarycfg.loadEntitlement(cfg.entitlementDir, server) assert (rc == value) os.unlink(fullPath) f = open(fullPath, "w") f.write("#!/bin/bash\n") f.write("cat <<EOFEOF\n") f.write(content) f.write("EOFEOF\n") f.close() os.chmod(fullPath, 0755) rc = conarycfg.loadEntitlement(cfg.entitlementDir, server) assert (rc == value)
def _doTest(cfg, server, content, value): fullPath = os.path.join(cfg.entitlementDir, server) open(fullPath, "w").write(content) os.chmod(fullPath, 0644) rc = conarycfg.loadEntitlement(cfg.entitlementDir, server) assert(rc == value) os.unlink(fullPath) f = open(fullPath, "w") f.write("#!/bin/bash\n") f.write("cat <<EOFEOF\n") f.write(content) f.write("EOFEOF\n") f.close() os.chmod(fullPath, 0755) rc = conarycfg.loadEntitlement(cfg.entitlementDir, server) assert(rc == value)