Slack import unit tests (#4201)
* Slack Import unit tests (for some functions). Covers the completely self contained functions in the Slack Importer that are straightforward to unit test. JSON processing functions are not yet unit tested. * Unit tests for Slack Import JSON parsing. This tests the 3 functions for parsing JSON, using a sample set of Slack data for posts, channels, and users.
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
3a369c9de8
Коммит
8c8bc7111c
180
tests/slack-import-test-posts.json
Обычный файл
180
tests/slack-import-test-posts.json
Обычный файл
@@ -0,0 +1,180 @@
|
||||
[
|
||||
{
|
||||
"type": "message",
|
||||
"user": "U07Q4MHCP",
|
||||
"text": "<@U24CG47QU>",
|
||||
"ts": "1472932439.000002"
|
||||
},
|
||||
{
|
||||
"user": "U07Q4MHCP",
|
||||
"text": "<@U07Q4MHCP|lindy> has left the channel",
|
||||
"type": "message",
|
||||
"subtype": "channel_leave",
|
||||
"ts": "1469440454.000002"
|
||||
},
|
||||
{
|
||||
"user": "U15FUR1QS",
|
||||
"purpose": "Let's discuss our next monthly outing",
|
||||
"type": "message",
|
||||
"subtype": "channel_purpose",
|
||||
"text": "<@U15FUR1QS|igor> set the channel purpose: Let's discuss our next monthly outing",
|
||||
"ts": "1462216387.000003"
|
||||
},
|
||||
{
|
||||
"type": "message",
|
||||
"subtype": "file_share",
|
||||
"text": "<@U07Q4MHCP|lindy> uploaded a file: <https:\/\/slackexportteam.slack.com\/files\/lindy\/F1WB5FH7W\/pdf.pdf|Pdf.pdf>",
|
||||
"file": {
|
||||
"id": "F1WB5FH7W",
|
||||
"created": 1469782519,
|
||||
"timestamp": 1469782519,
|
||||
"name": "Pdf.pdf",
|
||||
"title": "Pdf.pdf",
|
||||
"mimetype": "application\/pdf",
|
||||
"filetype": "pdf",
|
||||
"pretty_type": "PDF",
|
||||
"user": "U07Q4MHCP",
|
||||
"editable": false,
|
||||
"size": 457717,
|
||||
"mode": "hosted",
|
||||
"is_external": false,
|
||||
"external_type": "",
|
||||
"is_public": true,
|
||||
"public_url_shared": false,
|
||||
"display_as_bot": false,
|
||||
"username": "",
|
||||
"url_private": "https:\/\/files.slack.com\/files-pri\/T07Q4MHC7-F1WB5FH7W\/pdf.pdf?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"url_private_download": "https:\/\/files.slack.com\/files-pri\/T07Q4MHC7-F1WB5FH7W\/download\/pdf.pdf?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"permalink": "https:\/\/slackexportteam.slack.com\/files\/lindy\/F1WB5FH7W\/pdf.pdf",
|
||||
"permalink_public": "https:\/\/slack-files.com\/T07Q4MHC7-F1WB5FH7W-8560bd68a4",
|
||||
"channels": [
|
||||
"C07Q4MBTL"
|
||||
],
|
||||
"groups": [
|
||||
|
||||
],
|
||||
"ims": [
|
||||
|
||||
],
|
||||
"comments_count": 0
|
||||
},
|
||||
"user": "U07Q4MHCP",
|
||||
"upload": true,
|
||||
"display_as_bot": false,
|
||||
"username": "<@U07Q4MHCP|lindy>",
|
||||
"bot_id": null,
|
||||
"ts": "1469782519.000002"
|
||||
},
|
||||
{
|
||||
"user": "U24CG47QU",
|
||||
"text": "<@U24CG47QU|lindy.invite> has joined the channel",
|
||||
"type": "message",
|
||||
"subtype": "channel_join",
|
||||
"ts": "1472028157.000002"
|
||||
},
|
||||
{
|
||||
"bot_id": "B13CH9S5V",
|
||||
"attachments": [
|
||||
{
|
||||
"fallback": "<https:\/\/twitter.com\/m2pls|@m2pls>: M2 informatique PLS et EID2 on vous retrouve sur le <https:\/\/twitter.com\/mattermosthq|@mattermosthq> du master, les invitations partiront lundi (ou demander en MP).",
|
||||
"ts": 1474722287,
|
||||
"author_name": "Master 2 PLS",
|
||||
"author_link": "https:\/\/twitter.com\/m2pls\/status\/779667900600844288",
|
||||
"author_icon": "https:\/\/pbs.twimg.com\/profile_images\/649829889890086912\/ULpVHs9S_normal.jpg",
|
||||
"author_subname": "@m2pls",
|
||||
"pretext": "<https:\/\/twitter.com\/m2pls\/status\/779667900600844288>",
|
||||
"text": "M2 informatique PLS et EID2 on vous retrouve sur le <https:\/\/twitter.com\/mattermosthq|@mattermosthq> du master, les invitations partiront lundi (ou demander en MP).",
|
||||
"service_name": "twitter",
|
||||
"service_url": "https:\/\/twitter.com\/",
|
||||
"from_url": "https:\/\/twitter.com\/m2pls\/status\/779667900600844288",
|
||||
"id": 1,
|
||||
"footer": "Twitter",
|
||||
"footer_icon": "https:\/\/a.slack-edge.com\/6e067\/img\/services\/twitter_pixel_snapped_32.png"
|
||||
}
|
||||
],
|
||||
"text": null,
|
||||
"type": "message",
|
||||
"subtype": "bot_message",
|
||||
"ts": "1474722288.637240"
|
||||
},
|
||||
{
|
||||
"type": "message",
|
||||
"user": "U07Q4MHCP",
|
||||
"text": "<https:\/\/slackexportteam.slack.com\/archives\/general\/p1469781868000005>",
|
||||
"attachments": [
|
||||
{
|
||||
"from_url": "https:\/\/slackexportteam.slack.com\/archives\/general\/p1469781868000005",
|
||||
"fallback": "[July 29th, 2016 1:44 AM] lindy: permalink?",
|
||||
"ts": "1469781868.000005",
|
||||
"author_subname": "lindy",
|
||||
"channel_id": "C07Q4SBL3",
|
||||
"channel_name": "general",
|
||||
"is_msg_unfurl": true,
|
||||
"text": "permalink?",
|
||||
"author_link": "https:\/\/slackexportteam.slack.com\/team\/lindy",
|
||||
"author_icon": "https:\/\/secure.gravatar.com\/avatar\/822d051544b1f50f1e9f015cd2990edc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F0180%2Fimg%2Favatars%2Fava_0001-48.png",
|
||||
"mrkdwn_in": [
|
||||
"text"
|
||||
],
|
||||
"id": 1,
|
||||
"footer": "Posted in #general"
|
||||
}
|
||||
],
|
||||
"ts": "1469781880.000006"
|
||||
},
|
||||
{
|
||||
"type": "message",
|
||||
"subtype": "file_share",
|
||||
"text": "<@U07Q4MHCP|lindy> uploaded a file: <https:\/\/slackexportteam.slack.com\/files\/lindy\/F1WBDJW93\/fb-wow.gif|fb-wow.gif>",
|
||||
"file": {
|
||||
"id": "F1WBDJW93",
|
||||
"created": 1469782076,
|
||||
"timestamp": 1469782076,
|
||||
"name": "fb-wow.gif",
|
||||
"title": "fb-wow.gif",
|
||||
"mimetype": "image\/gif",
|
||||
"filetype": "gif",
|
||||
"pretty_type": "GIF",
|
||||
"user": "U07Q4MHCP",
|
||||
"editable": false,
|
||||
"size": 27235,
|
||||
"mode": "hosted",
|
||||
"is_external": false,
|
||||
"external_type": "",
|
||||
"is_public": true,
|
||||
"public_url_shared": false,
|
||||
"display_as_bot": false,
|
||||
"username": "",
|
||||
"url_private": "https:\/\/files.slack.com\/files-pri\/T07Q4MHC7-F1WBDJW93\/fb-wow.gif?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"url_private_download": "https:\/\/files.slack.com\/files-pri\/T07Q4MHC7-F1WBDJW93\/download\/fb-wow.gif?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"thumb_64": "https:\/\/files.slack.com\/files-tmb\/T07Q4MHC7-F1WBDJW93-7031b90b93\/fb-wow_64.png?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"thumb_80": "https:\/\/files.slack.com\/files-tmb\/T07Q4MHC7-F1WBDJW93-7031b90b93\/fb-wow_80.png?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"thumb_360": "https:\/\/files.slack.com\/files-tmb\/T07Q4MHC7-F1WBDJW93-7031b90b93\/fb-wow_360.png?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"thumb_360_w": 59,
|
||||
"thumb_360_h": 59,
|
||||
"thumb_160": "https:\/\/files.slack.com\/files-tmb\/T07Q4MHC7-F1WBDJW93-7031b90b93\/fb-wow_160.png?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"image_exif_rotation": 1,
|
||||
"original_w": 59,
|
||||
"original_h": 59,
|
||||
"deanimate_gif": "https:\/\/files.slack.com\/files-tmb\/T07Q4MHC7-F1WBDJW93-7031b90b93\/fb-wow_deanimate_gif.png?t=xoxe-7820731415-83616398485-83620610359-b95751e3ea",
|
||||
"permalink": "https:\/\/slackexportteam.slack.com\/files\/lindy\/F1WBDJW93\/fb-wow.gif",
|
||||
"permalink_public": "https:\/\/slack-files.com\/T07Q4MHC7-F1WBDJW93-718081d960",
|
||||
"channels": [
|
||||
"C07Q4SBL3"
|
||||
],
|
||||
"groups": [
|
||||
|
||||
],
|
||||
"ims": [
|
||||
|
||||
],
|
||||
"comments_count": 0
|
||||
},
|
||||
"user": "U07Q4MHCP",
|
||||
"upload": true,
|
||||
"display_as_bot": false,
|
||||
"username": "<@U07Q4MHCP|lindy>",
|
||||
"bot_id": null,
|
||||
"ts": "1469782077.000010"
|
||||
}
|
||||
]
|
||||
Ссылка в новой задаче
Block a user