feat: restructure python app and add option to add tests for apps
This commit is contained in:
@@ -37,9 +37,13 @@ class Service(BaseModel):
|
||||
def name_lower(self):
|
||||
return self.name.lower()
|
||||
|
||||
@property
|
||||
def name_lower_underscores(self):
|
||||
return self.name.replace("-", "_").lower()
|
||||
|
||||
@property
|
||||
def dir_name(self):
|
||||
return f"{self.name_lower}"
|
||||
return self.name.lower()
|
||||
|
||||
def to_dict(self):
|
||||
return {"name": self.name_lower, "ioc_port": self.ioc_port, "status": str(self.status)}
|
||||
@@ -50,8 +54,8 @@ class Service(BaseModel):
|
||||
@field_validator("name")
|
||||
@classmethod
|
||||
def validate_name_chars(cls, value: str) -> str:
|
||||
if not re.match(r"^[a-zA-Z0-9-]+$", value):
|
||||
raise ValueError("name can only contain letters, numbers, and dashes")
|
||||
if not re.match(r"^[a-z0-9-]+$", value):
|
||||
raise ValueError("name can only contain lowercase letters, numbers, and dashes")
|
||||
return value
|
||||
|
||||
|
||||
|
||||
@@ -221,6 +221,7 @@ class ServiceCreator:
|
||||
data={
|
||||
"service_name_upper": service.name_upper,
|
||||
"service_name_lower": service.name_lower,
|
||||
"service_name_lower_underscores": service.name_lower_underscores,
|
||||
"user": user,
|
||||
"ui_filename": self.ui_filename,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user