hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Add test for creating blank username

Open tomberek opened this issue 4 years ago • 2 comments
trafficstars

Perhaps a different exit code. But this should fail. Preferably enforced in DB, not just a hydra-create-user check.

Fixes #1010

tomberek avatar Aug 28 '21 21:08 tomberek

btw: i like the test framework. Well done @grahamc !

The following jobs failed:
+--------------------------------------+-----------------------------+
| Job ID                               | Test File                   |
+--------------------------------------+-----------------------------+
| EA504342-0849-11EC-ADE6-FBEAC307D883 | scripts/hydra-create-user.t |
+--------------------------------------+-----------------------------+

                                  Yath Result Summary
( STDERR )  job 36    initialising the Hydra database schema...
[  FAIL  ]  job 36  +~Handling password and password hash creation
< REASON >  job 36    Subtest failures were encountered (Count: 1)
[  FAIL  ]  job 36    +~Creating a user with a blank username should fail
[  FAIL  ]  job 36    | + hydra-create-user should exit one
[  DEBUG ]  job 36    | | scripts/hydra-create-user.t line 57
(  DIAG  )  job 36    | | +-----+----+-------+
(  DIAG  )  job 36    | | | GOT | OP | CHECK |
(  DIAG  )  job 36    | | +-----+----+-------+
(  DIAG  )  job 36    | | | 0   | eq | 1     |
(  DIAG  )  job 36    | | +-----+----+-------+

tomberek avatar Aug 28 '21 21:08 tomberek

:+1: thanks! Probably the next step is looking in to dbix::class for pre-save/pre-create validation hooks. I'm not sure if it supports them, but that would be the ideal fix. If it is, it'd be good to create a test at that level too.

grahamc avatar Aug 28 '21 23:08 grahamc