def execute(filepath): valid, payload = jsonutil.load_and_validate_payload( schemas, request.Request.IN) if valid is False: return -1 prefix = jsonutil.get_source_value(payload, "prefix") version = jsonutil.get_version(payload, "version") if prefix is (None or "") or not prefix.isalpha(): common.log("invalid Prefix") return -1 file_io.write_to_file(os.path.join(filepath, "default"), name_generator.generate_default(version, prefix)) file_io.write_to_file(os.path.join(filepath, "heroku"), name_generator.generate_heroku(version, prefix)) print(json.dumps({"version": {"version": version}})) return 0
def test_output_heroku(self): out = name_generator.generate_default("test", "1.1.2") self.assertEquals = (out, "test_1_1_2")
def test_output_default(self): out = name_generator.generate_default("test", "1.1.2") self.assertEquals = (out, "test-1-1-2")
def test_output_heroku_emptyversion(self): out = name_generator.generate_default("test", "") self.assertEquals = (out, "test_")