mattermost/tests
mkraft 7fa6b321ae
Custom groups (#18839)
* WIP

* adding initial creategroup endpoint

* fetching by group source

* fixing startup error

* updating create endpoint to take an array of user_ids, this will allow us to create the group with one request

* adding delete group endpoint and appropriate test

* adding source param for getGroups

* adding add members and delete members endpoints

* locking down crud endpoints to only be allowed for custom groups

* user search stuff

* allowing remoteid be null by changing field to pointer

* code cleanup and store level tests

* adding new tests and removing unused endpoint

* resolving conflicts

* Adds authz check for group.

* Adds authz checks to groups APIs.

* Updated create group authz tests.

* Updates delete group tests.

* Tests create group.

* Adds some tests and validations.

* adding new parameter so I can get users not in a group

* Fixed all lint warnings.

* Fix type.

* fixing search users not in group

* Fixes some lint errors.

* Moves entry in JSON array.

* Fixed SQL query.

* Fixes permission migration test.

* Fixes migration test.

* Fixes some group store tests.

* Fix test.

* Fix test.

* Revert lint change.

* Migrated CreateWithUserIds to sqlx.

* Adds tests for GetMember; migrates implementation to sqlx.

* Tests GetNonMemberUsersPage and hanles wrong group id.

* Fixes test.

* Switches GetMaster to GetMasterX.

* Switches GetReplica to GetReplicaX.

* Fixes logic.

* Fixes shadow declaration.

* Adds include_member_count to get group API endpoint.

* Adds filter_has_member param to getGroups.

* Fixes.

* Removes array of group sources.

* fixing error

* Testing reverting CreateWithUserIds back to gorp.

* Added websocket event for CreateGroupWithUserIds.

* Changed a few response status codes. Switched to correct permission.

* Added member count to ws payload for group when updating or creating.

* Adds feature flag checks for custom groups.

* Added middleware function to require license. Added config to disable custom groups.

* Change for function signature change of executePossiblyEmptyQuery.

* Lint fixes.

* Adds telemetry none comment.

* Adds translations.

* Migrated to sqlx.

* Temp. removal of translation.

* Fixed typo.

* Added an intermediary model to query with a field that is now ignored by sqlx on read queries.

* Re-used existing store struct.

* Inludes member count.

* Fix for merge error.'

* Require license for group endpoints.

* Updates translations.

* Fix shadow declaration.

* Renames permissions. Switches to new method to retrieve remoteid.

* Added WS events for upsert and delete member(s).

* Added new store error type ErrUniqueConstraint.

* Added EnableCustonGroups to the client config.

* Sanitized some user records.

* Added parameter to include_total_count for listing groups.

* Added translations.

* adding deleteAt field to getByUsers query

* Revert sanitize.

* Added uniqueness constraint error to UpdateGroup.

* Removed the FutureFeatures flag so that the feature is not enabled on old Enterprise licenses.

* Renamed function.

* Updates authz check for user search related to groups.

* Removed debug statement.

* Removed unused app method.

* Added telemetry for enable_custom_groups.

* Returns early from nil license.

* Updates test.

* Returned early to avoid nesting in (*SqlGroupStore).checkUserExist. Switched to reading from replica in (*SqlGroupStore).GetMember. Handled JSON marshal error in (*Client4).UpsertGroupMembers

* Switched to SanitizeProfile.

* Switched to model.NewInt.

* Switched from status NotImplemented to Forbidden for missing license.

* Removed deactivated users from 'exists' set.

* Revert gotool update.

* Ignored lint error that I think is invalid.

* Added the approprate access tag for disabling custom groups.

* Revert change to response status.

* Fixed refactor mistake.

* Limited the group member WS events to individual users.

* Removed WS event of deleted groups.

* Updated license check for searchUsers endpoint.

* Switched from license feature to license sku.

* Update app/group.go

Co-authored-by: Claudio Costa <cstcld91@gmail.com>

* Update app/group.go

Co-authored-by: Claudio Costa <cstcld91@gmail.com>

* Remove linter ignore comment.

* Added function to create sku-specific license.

* Fixed typo. Removed comment.

* Fixed for wrong type.

* Added missing param to client. Removed unnecessary props setting. Added test for retrieving groups by source.

* Updated some tests now that we're validating group membership not created for deactivated user.

* Fix for groups endpoint returning all group types by default.

* Changes constant names. Adds migration for all users to manage custom group members.

* Removes requirement for manage_system permission to filter user search by group.

* Added migration mock.

* Removes default permissions from custom_group_user role.

* Fixes migration.

* Fixes emoji migration test.

* fixing issue with member counts

* fixing search issue for deleted members

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.fritz.box>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
2022-02-17 12:34:39 -05:00
..
1x10000.png [MM-28638] Improve image thumbnail generation logic (#15534) 2020-10-09 08:47:20 +02:00
1x10000_expected_preview.jpeg [MM-28638] Improve image thumbnail generation logic (#15534) 2020-10-09 08:47:20 +02:00
1x10000_expected_thumb.jpeg [MM-28638] Improve image thumbnail generation logic (#15534) 2020-10-09 08:47:20 +02:00
10000x1.png [MM-28638] Improve image thumbnail generation logic (#15534) 2020-10-09 08:47:20 +02:00
10000x1_expected_preview.jpeg [MM-28638] Improve image thumbnail generation logic (#15534) 2020-10-09 08:47:20 +02:00
10000x1_expected_thumb.jpeg [MM-28638] Improve image thumbnail generation logic (#15534) 2020-10-09 08:47:20 +02:00
channel-role-has-permission.csv MM-22212 & MM-22208: Read from the higher-scoped scheme if the permission is non-moderated. (#13813) 2020-03-23 13:44:20 -04:00
development-private-key.asc [MM-20309] production public key (#13244) 2019-12-05 23:41:52 +04:00
development-public-key.asc MM-16368 - Plugin Signing (#13017) 2019-11-18 19:02:41 -05:00
development-public-key.gpg MM-16368 - Plugin Signing (#13017) 2019-11-18 19:02:41 -05:00
export_test.zip [MM-38375] Fix processing bulk import with attachments (#18352) 2021-09-21 17:39:52 +02:00
Fake_Team_Import.rar Document extractor service (#15665) 2020-10-27 15:58:38 +01:00
Fake_Team_Import.tar.gz Document extractor service (#15665) 2020-10-27 15:58:38 +01:00
Fake_Team_Import.zip [APIV4] POST /teams/{team_id}/import for apiv4 (#5920) 2017-04-03 17:38:26 +01:00
fill_test_8bit_palette.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_8bit_palette_out.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_8bit_rgb.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_8bit_rgb_out.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_8bit_rgba.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_8bit_rgba_out.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_16bit_rgb.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_16bit_rgb_out.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_16bit_rgba.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_16bit_rgba_out.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
fill_test_opaque.png [MM-29241] Image logic refactor (#17702) 2021-06-05 17:08:29 +08:00
group-role-has-permission.csv Custom groups (#18839) 2022-02-17 12:34:39 -05:00
import_test.zip [MM-28422] Enable processing of import files through API (#16062) 2020-12-03 11:38:00 +01:00
orientation_test.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_1.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_1_expected_preview.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_1_expected_thumb.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_2.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_2_expected_preview.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_2_expected_thumb.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_3.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_3_expected_preview.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_3_expected_thumb.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_4.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_4_expected_preview.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_4_expected_thumb.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_5.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_5_expected_preview.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_5_expected_thumb.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_6.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_6_expected_preview.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_6_expected_thumb.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_7.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_7_expected_preview.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_7_expected_thumb.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_8.jpeg MM-7633: Optimize memory utilization during file uploads (#9835) 2018-12-13 22:32:07 +01:00
orientation_test_8_expected_preview.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
orientation_test_8_expected_thumb.jpeg MM-16997: Simplified TestUploadFiles (#11707) 2019-07-26 09:54:04 -07:00
qa-data-graph.png Ldap groups phase1 (#9752) 2019-01-10 15:17:31 -05:00
qa-data.ldif Ldap groups phase1 (#9752) 2019-01-10 15:17:31 -05:00
README.md [GH-19267] Spelling comments (#19268) 2022-01-20 10:07:27 +05:30
sample-doc.doc Making doc extraction more reliable (#17842) 2021-07-29 11:57:51 +02:00
sample-doc.docx Document extractor service (#15665) 2020-10-27 15:58:38 +01:00
sample-doc.odp Document extractor service (#15665) 2020-10-27 15:58:38 +01:00
sample-doc.odt Document extractor service (#15665) 2020-10-27 15:58:38 +01:00
sample-doc.pdf Document extractor service (#15665) 2020-10-27 15:58:38 +01:00
sample-doc.pptx Document extractor service (#15665) 2020-10-27 15:58:38 +01:00
sample-doc.rtf Document extractor service (#15665) 2020-10-27 15:58:38 +01:00
slack-import-test-channels.json Slack import unit tests (#4201) 2016-10-12 10:03:30 -04:00
slack-import-test-direct-messages.json Add Slack corporate import ability (#10905) 2019-06-04 17:11:29 -04:00
slack-import-test-group-direct-messages.json Add Slack corporate import ability (#10905) 2019-06-04 17:11:29 -04:00
slack-import-test-posts.json add support for new slack post format and multiple attachments in slack importer (#11415) 2019-07-11 10:47:51 +01:00
slack-import-test-private-channels.json Add Slack corporate import ability (#10905) 2019-06-04 17:11:29 -04:00
slack-import-test-users.json Slack import unit tests (#4201) 2016-10-12 10:03:30 -04:00
test-attachments.md Updated to Google Drive location (#7856) 2017-11-20 12:36:19 -08:00
test-config.json [MM-39374] Remove DesktopLatestVersion and DesktopMinVersion (#18979) 2021-11-12 10:37:43 -05:00
test-data-graph.png Ldap groups phase1 (#9752) 2019-01-10 15:17:31 -05:00
test-data.ldif [MM-31094] Replication Lag (#16888) 2021-03-12 12:37:30 -05:00
test-emoticons1.md PLT-7356 and 7378 Reduce size of emoji test posts (#7291) 2017-08-25 10:43:06 -04:00
test-emoticons2.md Remove duplicate Nature section (#7571) 2017-10-04 12:01:26 -07:00
test-emoticons3.md PLT-7356 and 7378 Reduce size of emoji test posts (#7291) 2017-08-25 10:43:06 -04:00
test-emoticons4.md PLT-7356 and 7378 Reduce size of emoji test posts (#7291) 2017-08-25 10:43:06 -04:00
test-emoticons5.md PLT-7356 and 7378 Reduce size of emoji test posts (#7291) 2017-08-25 10:43:06 -04:00
test-emoticons6.md PLT-7356 and 7378 Reduce size of emoji test posts (#7291) 2017-08-25 10:43:06 -04:00
test-hashtags.md Moving tests to /tests and removing /doc folder. Docs are now in seperate repository 2016-02-18 09:25:10 -05:00
test-link-preview.md Update link preview test cases (#5620) 2017-03-04 17:49:46 +00:00
test-links.md PLT-6813 Removed misleading and outdated link tests (#6767) 2017-06-28 07:27:32 -07:00
test-markdown-basics.md [GH-19267] Spelling comments (#19268) 2022-01-20 10:07:27 +05:30
test-markdown-lists.md Update markdown test for lists (#6131) 2017-04-18 08:26:25 -07:00
test-mentions.md Moving tests to /tests and removing /doc folder. Docs are now in seperate repository 2016-02-18 09:25:10 -05:00
test-public-key.plugin.gpg MM-16368 - Plugin Signing (#13017) 2019-11-18 19:02:41 -05:00
test-search.md Add special characters hashtag tests (#6132) 2017-04-18 11:05:31 +01:00
test-slack-attachments.json Fix parsing attachment field links into markdown (#2958) (#2959) 2016-05-12 08:30:44 -04:00
test-syntax-highlighting.md Remove old tests from syntax-highlighting.md (#2970) 2016-05-12 07:45:31 -04:00
test-tables.md Update test-tables.md (#6775) 2017-06-28 09:37:43 -04:00
test.png Converting to Webpack. Stage 1. 2016-03-16 18:02:55 -04:00
test.svg MM-15452 - Add ability to override LHS icon for bot accounts (#11423) 2019-07-06 08:56:21 +02:00
test.tiff MM-22056: Fix flaky test TestUploadFiles (#14234) 2020-04-07 07:09:04 -07:00
test_expected_tiff_preview.jpeg MM-22707: improved image upload tests and logging (#14018) 2020-03-17 10:20:29 +05:30
test_expected_tiff_thumb.jpeg MM-22707: improved image upload tests and logging (#14018) 2020-03-17 10:20:29 +05:30
testarchive.zip [MM-28422] Enable processing of import files through API (#16062) 2020-12-03 11:38:00 +01:00
testgif.gif Converting to Webpack. Stage 1. 2016-03-16 18:02:55 -04:00
testgif_expected_preview.jpg Generate preview regardless of HasPreviewImage value (#16535) 2020-12-11 00:15:17 +01:00
testgif_expected_thumbnail.jpg Generate preview regardless of HasPreviewImage value (#16535) 2020-12-11 00:15:17 +01:00
testjpg.jpg fix /test command (#14169) 2020-04-18 00:08:57 -07:00
testplugin.tar.gz Allow plugins to specify a ReleaseNotesURL via manifest (#13677) 2020-01-28 19:33:21 +01:00
testplugin.tar.gz.asc Allow plugins to specify a ReleaseNotesURL via manifest (#13677) 2020-01-28 19:33:21 +01:00
testplugin.tar.gz.sig Allow plugins to specify a ReleaseNotesURL via manifest (#13677) 2020-01-28 19:33:21 +01:00
testplugin2.tar.gz Allow plugins to specify a ReleaseNotesURL via manifest (#13677) 2020-01-28 19:33:21 +01:00
testplugin2.tar.gz.asc Allow plugins to specify a ReleaseNotesURL via manifest (#13677) 2020-01-28 19:33:21 +01:00
testplugin2.tar.gz.sig Allow plugins to specify a ReleaseNotesURL via manifest (#13677) 2020-01-28 19:33:21 +01:00
tls_test_cert.pem Set default ciphers, set tls 1.2 via config, set curve prefs (#9315) 2018-10-16 07:51:46 -07:00
tls_test_key.pem Set default ciphers, set tls 1.2 via config, set curve prefs (#9315) 2018-10-16 07:51:46 -07:00

Testing Text Processing

The text processing tests located in the doc/developer/tests folder are designed for use with the /test url command. This command posts the raw contents of a specified .md file in the doc/developer/test folder into Mattermost.

Turning on /test

Access the System Console from the Main Menu. Under Service Settings make sure that Enable Testing is set to true, then click Save. You may also change this setting from config.json by setting ”EnableTesting”: true. Changing this setting requires a server restart to take effect.

Running the Tests

In the text input box in Mattermost, type: /test url [file-name-in-testing-folder].md. Some examples:

/test url test-emoticons.md
/test url test-links.md

Notes:

  1. If a test has prerequisites, make sure your Mattermost setup meets the requirements described at the top of the test file.
  2. Some tests are over 4000 characters in length and will render across multiple posts.

Manual Testing

It is possible to manually test specific sections of any test, instead of using the /test command. Do this by clicking Raw in the header for the file when its open in GitHub, then copy and paste any section into Mattermost to post it. Manual testing only supports sections of 4000 characters or less per post.

Test plugins

There are two test plugins: testplugin.tar.gz and testplugin2.tar.gz. These are use in some integration tests in the api4 package. Any changes to the plugin bundles require updating the corresponding signatures.

First, import the public and private development key:

$ gpg --import ./development-public-key.gpg
$ gpg --import ./development-private-key.asc

This has to be done only once.

Then update the signatures:

$ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign testplugin.tar.gz
$ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign --armor testplugin.tar.gz
$ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign testplugin2.tar.gz
$ gpg -u F3FACE45E0DE642C8BD6A8E64C7C6562C192CC1F --verbose --personal-digest-preferences SHA256 --detach-sign --armor testplugin2.tar.gz

Finally, include the updates bundles and signatures in your commit.