This repository was archived by the owner on Apr 27, 2023. It is now read-only.
File tree 1 file changed +18
-0
lines changed
codebrag-dao/src/test/scala/com/softwaremill/codebrag/dao/user
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -384,6 +384,24 @@ class SQLUserDAOSpec extends FlatSpecWithSQL with ClearSQLDataAfterTest with Bef
384
384
// then
385
385
assert(deletedUser === None , " Deletion was attempted but found " + deletedUser)
386
386
}
387
+ it should " deleta a user and should not show in the list " taggedAs RequiresDb in {
388
+ // given
389
+ val user = UserAssembler .randomUser.withBasicAuth(" user" , " pass" ).withAdmin(set = false ).withActive(set = false ).get
390
+ userDAO.add(user)
391
+ val newAuth = Authentication .basic(user.authentication.username, " newpass" )
392
+
393
+ // when
394
+ val tobeDeletedUser = user.copy(authentication = newAuth, admin = true , active = true )
395
+ val userCountBeforeDelete = userDAO.findAll().length
396
+ userDAO.delete(tobeDeletedUser.id)
397
+ val deletedUser = userDAO.findById(user.id)
398
+ val userCountAfterDelete = userDAO.findAll().length
399
+ // then
400
+ assert(deletedUser === None , " Deletion was attempted but found " + deletedUser)
401
+ userCountAfterDelete should be(userCountBeforeDelete - 1 )
402
+
403
+ }
404
+
387
405
" rememberNotifications" should " store dates properly" taggedAs RequiresDb in {
388
406
// given
389
407
val user = UserAssembler .randomUser.get
You can’t perform that action at this time.
0 commit comments