Create a new environment with a unique ID
(self, name: str, slug: str, **kwargs)
| 430 | ) |
| 431 | |
| 432 | def create_environment(self, name: str, slug: str, **kwargs) -> dict: |
| 433 | """Create a new environment with a unique ID""" |
| 434 | if self.has_active_environment_with_slug(slug): |
| 435 | raise ValueError(f"An active environment with slug '{slug}' already exists") |
| 436 | |
| 437 | env = { |
| 438 | "id": token_hex(4), |
| 439 | "name": name, |
| 440 | "slug": slug, |
| 441 | "status": "active", |
| 442 | **kwargs, |
| 443 | } |
| 444 | environments = self.environments.copy() |
| 445 | environments.append(env) |
| 446 | self.environments = environments |
| 447 | return env |
| 448 | |
| 449 | def update_environment(self, environment_id: str, values: dict) -> dict | None: |
| 450 | """Update environment""" |
no test coverage detected