View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
16919Bug reportsOtherpublic2021-03-10 21:12
Reporterollehar Assigned Toollehar  
PrioritynoneSeveritypartial_block 
Status assignedResolutionopen 
Product Version4.0.0dev 
Target Version4.x.0-dev 
Summary16919: Missing test suite for survey group permissions
Description

List of missing tests:

  • New field "Owner" in view "Create survey group" - test should save form and check that database value is updated correctly
TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)latest dev
I will donate to the project if issue is resolvedNo
Browser-
Database type & version-
Server OS (if known)-
Webserver software & version (if known)-
PHP Version-

Relationships

related to 16440 resolvedcdorin Feature requests Survey group Permission : minimal system 

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2020-12-22 16:28

developer   ~61042

My opinion : we must start by a simple "Global settings" update Permission test suite ?
No ?

ollehar

ollehar

2020-12-22 16:31

administrator   ~61043

Well, our current approach was to grow a test suite from new features. That was my idea, at least. But should be collaborative effort by contributors and core GmbH team.

DenisChenu

DenisChenu

2020-12-22 16:55

developer   ~61044

PS : i don't mind of new form action test …

DenisChenu

DenisChenu

2020-12-22 18:15

developer   ~61053

Well, our current approach was to grow a test suite from new features. That was my idea, at least. But should be collaborative effort by contributors and core GmbH team.

Yes, i understand : and it's in my todo list since month to add SurveysGroup permission checker when there are a solution to do action other than superadmin :)

But you are right : i didn't mind of GUI test suite here …

DenisChenu

DenisChenu

2021-01-13 08:50

developer   ~61514

Update category (clearly not encryption here)

DenisChenu

DenisChenu

2021-01-13 08:53

developer   ~61515

@ollehar : i can easily add Survey permision checker
BUT :

Maybe i try an update of login user id directly in session ?

ollehar

ollehar

2021-01-13 10:25

administrator   ~61518

user can grant more permissions on a survey than he has himself

To make a test for this without database, you need to take the controller action and rip out everything that's not related to database or request parsing, and put it in a service class with injection or possibility to mock. In other words, business logic should be in service classes to be testable. :) But, let me merge your PR first and have a look.

DenisChenu

DenisChenu

2021-01-13 10:33

developer   ~61522

Then : mock Permission->save() and check if data sent via our mocked POST was in save data ?

And even if Permission->save happen for specific permission …

To mock :

  • Survey->havePermission() : send false to the current user for permisison1 and true for permission2
  • Permission->save() : check is save
    • didn't happen for permisison1
    • happen for permisison2

Issue History

Date Modified Username Field Change
2020-12-22 16:22 ollehar New Issue
2020-12-22 16:22 ollehar Relationship added related to 16440
2020-12-22 16:22 ollehar Assigned To => DenisChenu
2020-12-22 16:22 ollehar Status new => assigned
2020-12-22 16:23 ollehar Description Updated
2020-12-22 16:24 ollehar Assigned To DenisChenu => ollehar
2020-12-22 16:28 DenisChenu Note Added: 61042
2020-12-22 16:31 ollehar Note Added: 61043
2020-12-22 16:55 DenisChenu Note Added: 61044
2020-12-22 18:15 DenisChenu Note Added: 61053
2021-01-13 08:50 DenisChenu Category Encryption => Other
2021-01-13 08:50 DenisChenu Note Added: 61514
2021-01-13 08:53 DenisChenu Note Added: 61515
2021-01-13 10:25 ollehar Note Added: 61518
2021-01-13 10:33 DenisChenu Note Added: 61522
2021-03-10 21:12 ollehar Product Version => 4.0.0dev