Commit graph

885 commits

Author SHA1 Message Date
Sonja Happ
4914af6c47 - revise simulation model testing
- add validators for simulation model endpoints
- revise endpoint implementations and fix responses of simulation models
- clean up testdata, serializers and responses for simulation models
- change default values of output length and input length of signal mappings to 0
2019-09-05 16:17:00 +02:00
Sonja Happ
9c809e526a check for empty Properties of update 2019-09-05 16:13:25 +02:00
Sonja Happ
5eb1487239 check for empty startParams of update 2019-09-05 16:13:07 +02:00
Sonja Happ
a8d59f17e7 add checkPermissions function as middleware of simulator 2019-09-05 12:38:01 +02:00
Sonja Happ
a55d039ee7 - revise testing of simulators
- add validators for simulators
- clean up testdata, serializers and responses
- update documentation for swaggo
2019-09-05 12:23:44 +02:00
Sonja Happ
7bc94c1131 fix documentation 2019-09-05 12:22:41 +02:00
Sonja Happ
16b3499126 get rid of Request struct as is caused more trouble than good 2019-09-05 09:11:56 +02:00
Sonja Happ
5855fccbe3 Fix documentation of endpoints for swaggo 2019-09-04 16:48:24 +02:00
Sonja Happ
3a2cd79fd0 Revision of error messages for middleware 2019-09-04 16:47:46 +02:00
Sonja Happ
2772bde5ee - Modify scenario testing
- Add scenario validators
- Clean up responses and serializes with respect to scenario
- Fix error handling and responses of scenario endpoints
2019-09-04 16:31:20 +02:00
Sonja Happ
46e84fc758 return the gorm error in case user was not found 2019-09-04 16:18:36 +02:00
Sonja Happ
768a108627 add credentials for UserA and UserB 2019-09-04 09:58:08 +02:00
Sonja Happ
588da0455d add fields for scenario, fix a typo 2019-09-04 09:57:32 +02:00
Sonja Happ
3963bb37a4 use copies of global test data when adding users to DB, add a function that adds admin and 2 normal users to DB 2019-09-04 09:07:09 +02:00
Sonja Happ
0d389e9cd5 start each user test function with an empty DB containing only the admin user 2019-09-04 09:05:19 +02:00
Sonja Happ
770af7ad97 remove fM function from DB testing 2019-09-04 08:47:58 +02:00
Sonja Happ
69c299215c database testing: do not use regular DB name for DB testing but only dummy DB 2019-09-03 17:19:44 +02:00
Sonja Happ
6221f7d851 user testing: fix responses of successful queries 2019-09-03 16:59:30 +02:00
Sonja Happ
8ba553e36d remove preloading from user and scenario many to many associations 2019-09-03 16:40:27 +02:00
Sonja Happ
678b39a3c2 remove tage unique from Model.ID since it destroys many2many relationship 2019-09-03 16:37:26 +02:00
Sonja Happ
aa749c1c19 delete user_scenarios table that is auto created for many2many associations between scenarios and users 2019-09-03 16:36:37 +02:00
Sonja Happ
8dcc1a8ec2 database testing: fix in many to many relationship of scenarios and users 2019-09-03 15:48:45 +02:00
Sonja Happ
ac6b25c1ca do not use refs in many to many associations 2019-09-03 15:30:28 +02:00
Sonja Happ
0e96f643e5 remove not null tag from scenario users field and add semicolons 2019-09-03 15:24:13 +02:00
Sonja Happ
36dfda1ac0 do not change global test data in database tests, add data in each test function and do not use populateDummyDB function in DB testing 2019-09-03 15:12:18 +02:00
Sonja Happ
dee277bf19 revise database testing 2019-09-03 14:16:01 +02:00
Sonja Happ
95dc4998cf use spaces instead of commas to separate tags of model definitions 2019-09-03 12:46:19 +02:00
Sonja Happ
055d4ff4f0 fixes an error formatting bug in NewAuthenticateForTest method 2019-09-03 12:10:17 +02:00
Sonja Happ
bddbfc028d fix swaggo documentation of user endpoints 2019-09-03 12:03:47 +02:00
Sonja Happ
9c7bb228d3 add 2 TODOs in scenario get endpoints 2019-09-03 08:59:06 +02:00
smavros
5ac7b5b348 Adds test for user's not allowed actions 2019-08-30 18:19:10 +02:00
smavros
67e4043071 Extends test for GET /users auth as role=User 2019-08-30 15:59:59 +02:00
smavros
f4a15e914e Merge branch 'master' into test-user-endpoints 2019-08-30 15:47:54 +02:00
smavros
0b542f1b2e Added the bash curl script for API testing 2019-08-28 13:27:24 +02:00
smavros
68feed0dac Small improvements in user endpoints 2019-08-25 21:52:36 +02:00
smavros
6d307a6aa6 Improves NewAuthenticateForTest() 2019-08-25 21:41:42 +02:00
smavros
9e01b54307 Improves TestAddUser by testing also GET method 2019-08-25 21:24:55 +02:00
smavros
6959e65bce Adds test for deleting user 2019-08-25 21:03:49 +02:00
smavros
2c087e80e7 Adds test for invalid user update 2019-08-25 20:55:44 +02:00
smavros
4d79f06aba Renaming - Uses only one modRequest variable in user test 2019-08-25 20:02:35 +02:00
smavros
d6cc9ed224 Fixes bug in modify non-Admin user fields 2019-08-25 19:59:47 +02:00
smavros
5c820982e4 Adds test for user who modifies his credentials 2019-08-25 19:58:56 +02:00
smavros
40aa2ccd5f Simplifies NewAuthenticateForTest():
The NewAuthenticateForTest() must always get an HTTP response 200 so
    we do not have to pass an argument of the expected code.
2019-08-25 18:03:35 +02:00
smavros
c00d0e0422 Uses GetResponseID() instead of LengthOfResponse() in user test 2019-08-25 17:05:00 +02:00
smavros
5eed44f8f3 Adds function GetResponseID() for reading "id" 2019-08-25 10:58:02 +02:00
smavros
e0746f112f Minor changes in modify user test 2019-08-23 13:05:31 +02:00
smavros
0e0936a736 Adds test for user endpoint:
- For getting all the users
    - For modifying a user as Admin
    - For adding a user
2019-08-19 11:44:08 +02:00
smavros
89bdb59e5d Separates NewTestEndpoint() response and code comparison:
NewTestEndpoint() function must only send the HTTP request to the
    server and return the code, response and an error. This serves cases
    where the response cannot be compared with a predefined message e.g.
    when a new user is added we should not assume its assigned ID
    beforehand. The assertions of probable error, non-200 codes and non
    expected response bodies should be done inside the test function.
2019-08-18 18:44:41 +02:00
smavros
02f2156c1e Changes response of POST,PUT and DELETE:
For being able to easily debug and test the checkpoints which are
    adding, modifying or deleting a user the response should be the
    affected user object. Not only its ID.
2019-08-18 17:17:16 +02:00
smavros
d3aa873732 Improves LengthOfResponse() 2019-08-17 20:53:33 +02:00