[Bug 19515] New: Refactor REST API session mocking to reduce ridiculous amounts of duplication
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Bug ID: 19515 Summary: Refactor REST API session mocking to reduce ridiculous amounts of duplication Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST api Assignee: koha-bugs@lists.koha-community.org Reporter: olli-antti.kivilahti@jns.fi The amount of duplication in REST API tests is beyond anything. I must be hallucinating. This adds a t::lib::Mocks::mock_session() which mocks a session reverting to defaults, and checks CGI::Session->flush for errors. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 --- Comment #1 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 68390 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68390&action=edit Bug 19515 - Refactor REST API session mocking to reduce ridiculous amounts of duplication The amount of duplication in REST API tests is beyond anything. I must be hallucinating. This adds a t::lib::Mocks::mock_session() which mocks a session reverting to defaults, and checks CGI::Session->flush for errors. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff --- Comment #2 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Please, stop this bad dream. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Nice title -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Refactor REST API session |Refactor REST API session |mocking to reduce |mocking to reduce code |ridiculous amounts of |duplication |duplication | CC| |tomascohen@gmail.com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=19512 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |19512 --- Comment #4 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- (In reply to Marcel de Rooy from comment #3)
Nice title
Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19512 [Bug 19512] Koha::File - wrapper/utility routines for file handling -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |14539 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14539 [Bug 14539] Introduction to castToObject(), aka. make a Koha::Object from various input types -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Hi Olli, good innitiative. Just some remarks: - You patch covers several endpoints not currently in master, so it won't apply. - It is way too much to make it dependent on the castToObject stuff, just a personal opinion: you can just my $patron = $builder->build_object({class=>'Koha::Patrons'}); to get a sample patron. This is already in master... - You are missing something that's important for testing: we need to be able to assign the patron specific permissions, something in the lines of: my $flags = ( $args->{authorized} ) ? 2**$args->{authorized} : 0; -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> ---
- You are missing something that's important for testing: we need to be able to assign the patron specific permissions, something in the lines of: my $flags = ( $args->{authorized} ) ? 2**$args->{authorized} : 0;
About this, this has been wrong in all submitted tests. I've implemented it correctly in bug 7317. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19515 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |WORKSFORME Status|Failed QA |RESOLVED --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- We have implemented Basic authentication, and it got really simple to test the API without this much trouble. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org