• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SwissDataScienceCenter / renku-data-services / 19181077268

07 Nov 2025 09:00PM UTC coverage: 86.352% (-0.5%) from 86.841%
19181077268

Pull #1059

github

web-flow
Merge fb47045e6 into 58a6e4765
Pull Request #1059: fix: patching of session custom resources

89 of 104 new or added lines in 5 files covered. (85.58%)

577 existing lines in 33 files now uncovered.

22791 of 26393 relevant lines covered (86.35%)

1.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.0
/components/renku_data_services/notebooks/api/schemas/servers_patch.py
1
"""Server PATCH schemas."""
2

3
from enum import Enum
2✔
4
from typing import Self
2✔
5

6
from marshmallow import EXCLUDE, Schema, fields, validate
2✔
7

8
from renku_data_services.notebooks import apispec
2✔
9

10

11
class PatchServerStatusEnum(Enum):
2✔
12
    """Possible values when patching a server."""
13

14
    Running = "running"
2✔
15
    Hibernated = "hibernated"
2✔
16

17
    @classmethod
2✔
18
    def list(cls) -> list[str]:
2✔
19
        """Get list of enum values."""
20
        return [e.value for e in cls]
2✔
21

22
    @classmethod
2✔
23
    def from_api_state(cls, state: apispec.State) -> Self:
2✔
24
        """Get the state from the apispec enum."""
UNCOV
25
        if state.value == cls.Running.value:
×
26
            return cls("running")
×
UNCOV
27
        return cls("hibernated")
×
28

29

30
class PatchServerRequest(Schema):
2✔
31
    """Simple Enum for server status."""
32

33
    class Meta:
2✔
34
        """Marshmallow schema configuration."""
35

36
        # passing unknown params does not error, but the params are ignored
37
        unknown = EXCLUDE
2✔
38

39
    state = fields.String(required=False, validate=validate.OneOf(PatchServerStatusEnum.list()))
2✔
40
    resource_class_id = fields.Int(required=False, validate=lambda x: x > 0)
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc