DakaraProject / dakara-server

Server for the Dakara Project
MIT License
8 stars 1 forks source link

Serialize work type ID #165

Open odrling opened 3 months ago

odrling commented 3 months ago

Serialize the ID of work types to be able to use the /api/library/work-types/{id} route, otherwise the ID has to be guessed.

Found while trying to implement feeding in https://github.com/Japan7/karaberus/issues/38

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.69%. Comparing base (7b916ae) to head (811c57d).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #165 +/- ## ======================================== Coverage 98.69% 98.69% ======================================== Files 73 73 Lines 1836 1836 ======================================== Hits 1812 1812 Misses 24 24 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Neraste commented 3 months ago

Please update test helper here.

odrling commented 3 months ago

I can't seem to get the tests to pass, id doesn't seem to be defined on WorkType and I couldn't understand why.

Neraste commented 3 months ago

Ah, the helper is also used to assert work type obtained by other serializers (namely, WorkTypeForWorkSerializer) that don't include the ID. So either you check for the ID in the appropriate tests, or you tweak the helper to check the ID only when needed (the former would be simpler).