Skip to content

Commit

Permalink
Merge branch 'main' into feature/report_creations_are_scheduled
Browse files Browse the repository at this point in the history
  • Loading branch information
Rieven authored Nov 20, 2024
2 parents 59384d6 + 3592e41 commit 2507ef8
Show file tree
Hide file tree
Showing 27 changed files with 301 additions and 379 deletions.
2 changes: 1 addition & 1 deletion docs/source/introduction/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ OpenKAT scans for vulnerabilities. If you find any, it is valid that you deal wi

Many organizations have their contact information in ``security.txt`` in the root of their domain, so you get straight to the right people. Not every organization handles it equally professionally, but that's no reason not to want to use that standard yourself.

If you find any vulnerabilities in the software of OpenKAT itself you can report them per e-mail to: security @ rdobeheer.nl (remove the spaces).
If you find any vulnerabilities in the software of OpenKAT itself you can report them per e-mail to: security @ irealisatie.nl (remove the spaces).

What are the plans for the future?
==================================
Expand Down
Empty file removed log.txt
Empty file.
562 changes: 235 additions & 327 deletions mula/docs/architecture.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions mula/docs/img/boefje_scheduler.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions mula/docs/img/diagram001.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram002.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram003.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram004.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram005.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram006.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram007.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram008.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram009.svg

This file was deleted.

4 changes: 0 additions & 4 deletions mula/docs/img/diagram010.svg

This file was deleted.

4 changes: 4 additions & 0 deletions mula/docs/img/normalizer_scheduler.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mula/docs/img/queue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mula/docs/img/report_scheduler.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mula/docs/img/scheduler.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mula/docs/img/scheduler_system.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mula/docs/img/schedulers.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mula/docs/img/schedules.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions mula/docs/img/schematic-drawing.svg

This file was deleted.

4 changes: 4 additions & 0 deletions mula/docs/img/tasks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions mula/scheduler/server/handlers/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def list(
return utils.paginate(request, results, count, offset, limit)

def create(self, schedule: serializers.ScheduleCreate) -> Any:
if not (schedule.deadline_at or schedule.schedule):
raise BadRequestError("Either deadline_at or schedule must be provided")

try:
new_schedule = models.Schedule(**schedule.model_dump())
except ValueError:
Expand Down
2 changes: 1 addition & 1 deletion mula/scheduler/server/serializers/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ScheduleCreate(BaseModel):

data: dict

schedule: str
schedule: str | None = None

deadline_at: datetime | None = None

Expand Down
25 changes: 25 additions & 0 deletions mula/tests/integration/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,31 @@ def test_post_schedule(self):
datetime.fromisoformat(response.json().get("deadline_at")[:-1]).astimezone(timezone.utc),
)

def test_post_schedule_explicit_deadline_at(self):
"""When a schedule is created, the deadline_at should be set if it is provided."""
item = functions.create_item(self.scheduler.scheduler_id, 1)
now = datetime.now(timezone.utc)
response = self.client.post(
"/schedules", json={"scheduler_id": item.scheduler_id, "data": item.data, "deadline_at": now.isoformat()}
)
self.assertEqual(201, response.status_code)
self.assertIsNone(response.json().get("schedule"))
self.assertEqual(
# NOTE: Remove Z from the end of the string. Until 3.11
# datetime.fromisoformat does not accept Z at the end of the string
datetime.fromisoformat(response.json().get("deadline_at")[:-1]).astimezone(timezone.utc),
now,
)

def test_post_schedule_schedule_and_deadline_at_none(self):
"""When a schedule is created, both schedule and deadline_at should not be None."""
item = functions.create_item(self.scheduler.scheduler_id, 1)
response = self.client.post("/schedules", json={"scheduler_id": item.scheduler_id, "data": item.data})
self.assertEqual(400, response.status_code)
self.assertEqual(
{"detail": "Bad request error occurred: Either deadline_at or schedule must be provided"}, response.json()
)

def test_post_schedule_invalid_schedule(self):
item = functions.create_item(self.scheduler.scheduler_id, 1)
response = self.client.post(
Expand Down
6 changes: 0 additions & 6 deletions mula/tests/integration/test_schedule_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ def test_create_schedule_deadline_at_takes_precedence(self):

self.assertEqual(schedule.deadline_at, now)

def test_create_schedule_not_provided_schedule(self):
"""When a schedule is created, the deadline_at should be None if schedule is not provided."""
schedule = models.Schedule(scheduler_id="test_scheduler_id", data={})

self.assertIsNone(schedule.deadline_at)

def test_create_schedule(self):
# Arrange
scheduler_id = "test_scheduler_id"
Expand Down

0 comments on commit 2507ef8

Please sign in to comment.