Commit graph

50 commits

Author SHA1 Message Date
f4c662940e Authentication: remove unused argument 2021-02-08 11:55:36 +01:00
Sonja Happ
616a1c74dc WIP: adding test data via JSON file #44 2021-01-26 15:44:51 +01:00
2625e16fbe config: fix typo GolbalConfig -> GlobalConfig 2021-01-25 10:57:25 +01:00
fee9e3aa6d allow passing token via URL query parameter (closes #49) 2020-11-23 17:29:50 +01:00
Sonja Happ
1de4d9c9c2 Code base refactoring: no functional changes, improving test coverage 2020-03-27 11:53:26 +01:00
Sonja Happ
70b2ded851 modularize main function, use DBpool instead of local DB in database package and all testing functions 2020-03-19 10:50:18 +01:00
Sonja Happ
92f22035c6 add GPL 3.0 license statement in all (not auto-generated) code files 2019-11-20 11:08:33 +01:00
Sonja Happ
6d4c84ec4e - InitDB returns error
- Check more errors in InitDB
- fix for healthz endpoint (error checking was wrong)
- remove dbinit parameter from config due to redundancy with mode parameter
2019-11-14 11:44:26 +01:00
Sonja Happ
7a64d4653a Some fixes with respect to config
- resolve some name overlappings
- InitConfig sets global config and returns error
- Add missing error handling
2019-11-14 10:38:51 +01:00
d546f7bc91 fix tests 2019-11-13 21:22:17 +01:00
Sonja Happ
7963ce5e78 remove DB_TEST and use DB_NAME instead, InitDB function now has parameter to specify if DB is used for testing or not 2019-11-11 12:06:53 +01:00
2311d643c6 fix repo path 2019-11-09 11:40:56 +01:00
Sonja Happ
df910c56f7 admin password required to change user's password as admin, fixes #24 2019-11-05 12:05:39 +01:00
Sonja Happ
bae3bc9046 user: admin user can change password of any user without knowing old password 2019-10-24 12:44:26 +02:00
Sonja Happ
2852c4897f user: adapt testing to new password update procedure 2019-10-24 12:26:25 +02:00
Sonja Happ
56eabdc194 change active flag in update user to string instead of bool 2019-09-17 17:19:21 +02:00
Sonja Happ
14972262c0 add "Active" bool property to user model, required modifications in user and scenario packages 2019-09-17 17:00:07 +02:00
Sonja Happ
b570956baf improve user package
- testing more error return codes
- remove some errors from code
- remove unnecessary code
- require a username of at least 3 letters/digits
2019-09-12 10:18:42 +02:00
Sonja Happ
ed1d7677f2 add testing of authentication endpoint, revise authentication endpoint 2019-09-11 17:09:36 +02:00
Sonja Happ
387c922059 Revision of (file) testing
- create a guest user and modify function that adds users to the DB for testing
- improve code coverage of file endpoint tests and remove some obsolete code from file package
- add more error info if role validation fails in all endpoints
- change response of GET files to only return the file data and nothing else
- fix some bugs in file endpoints that became visible by the tests
2019-09-11 12:30:01 +02:00
Sonja Happ
f3a7ed0e61 **Major revision of repository structure**
- rename common package to database
- move all code not related to database to new helper package
- add more test in database package to improve code coverage
- add a new (own) package for AMQP client
2019-09-10 16:28:57 +02:00
Sonja Happ
2ffda7cad8 - revise naming of some common functions
- improve returning of error codes by using common functions
- use a separate file for authentication endpoint to improve clarity of code
2019-09-09 15:30:17 +02:00
Sonja Happ
ac9e564bc8 - deleting old obsolete test functions
- move all data and functions solely used for testing to the file test_utilities
- get rid of utilities file
2019-09-09 12:11:55 +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
0d389e9cd5 start each user test function with an empty DB containing only the admin user 2019-09-04 09:05:19 +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
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
5c820982e4 Adds test for user who modifies his credentials 2019-08-25 19:58:56 +02:00
smavros
c00d0e0422 Uses GetResponseID() instead of LengthOfResponse() in user test 2019-08-25 17:05:00 +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
94ea3c4ebf Breaks user test into different testing functions 2019-08-15 18:16:30 +02:00
smavros
c2429394ed Renames VisitorAuthenticate() to RegisterAuthenticate() 2019-08-15 14:52:19 +02:00
smavros
426b834ea5 Modifies tests for accepting {"id":$userID} response 2019-08-15 14:37:13 +02:00
smavros
1e4a2ee7cb Adds test for PUT /user/$ID endpoint 2019-08-15 00:36:46 +02:00
smavros
86870e3075 Adds test for POST /user 2019-08-13 19:30:21 +02:00
smavros
59a37bf601 Removes Credentials type from common/models.go:
Every test will fail except from the user's package since it is the
    only one using the new Request type.
2019-08-13 19:21:39 +02:00
smavros
b6a269bdeb Deprecates ResponseMsgUses. Introduces common/requests.go 2019-08-13 17:41:04 +02:00
smavros
ae2737571f Adds test for GET /user/:ID 2019-08-13 16:56:10 +02:00
smavros
6aee1a7aca Improves NewAuthenticateForTest():
- As NewTestEndpoint() the credentials are passed as interface{} and
    marsaling is happening inside the function.
    - Add check for ignored error from http.NewRequest()
2019-08-11 20:03:23 +02:00
smavros
41bb54e933 Modifies NewTestEndpoint() and user_test:
Instead of marshaling the expected response in the test function the
    marshaling happens inside the NewTestEndpoint() where is passed as
    interface{}.
2019-08-11 19:41:48 +02:00
smavros
dbd8d7ddeb Adds DummyOnlyAdminDB() for testing with empty DB 2019-08-11 18:10:33 +02:00
smavros
8e185ecba4 Adds NewAuthenticateForTest() in common/utilities.go:
- The function must return the token and an error (string, error).
    In case of an error the token is going to be an empty string. The
    assertion for the error __must__ be executed in the body of the
    test. The utility functions __must not__ panic. All of the tests
    must use this function in the future.
2019-08-04 20:08:27 +02:00
smavros
e2430cadef Changes testing function in \users test file 2019-08-04 19:54:09 +02:00
smavros
cf69e59a5f Modifies testdata setup:
- Decorates User model with json tags for marshaling.
    - Introduces Model type same as gorm.Model with additional json tags
    for marshaling.
    - Modifies ResponseMsgUsers type.
    - Modifies the testdata for the users by including initializer for
    the Mode.ID field.
    - The scenario test fails for those changes
2019-07-30 20:31:59 +02:00
smavros
a283d32dff Adds first users endpoint test 2019-07-30 18:03:20 +02:00