{"id":20027071,"url":"https://github.com/unic/periskop","last_synced_at":"2026-03-14T22:04:56.742Z","repository":{"id":57451934,"uuid":"71765061","full_name":"unic/periskop","owner":"unic","description":"Integration testing for ChatOps via Slack ","archived":false,"fork":false,"pushed_at":"2017-01-31T16:52:06.000Z","size":27,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-01T03:38:08.689Z","etag":null,"topics":["chatops","command-line-app","integration-testing","slack","slack-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-24T07:51:21.000Z","updated_at":"2021-08-07T08:34:04.000Z","dependencies_parsed_at":"2022-09-13T19:31:21.992Z","dependency_job_id":null,"html_url":"https://github.com/unic/periskop","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unic%2Fperiskop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unic%2Fperiskop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unic%2Fperiskop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unic%2Fperiskop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unic","download_url":"https://codeload.github.com/unic/periskop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252427874,"owners_count":21746291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatops","command-line-app","integration-testing","slack","slack-bot"],"created_at":"2024-11-13T09:08:57.104Z","updated_at":"2026-03-14T22:04:51.696Z","avatar_url":"https://github.com/unic.png","language":"Python","readme":"# periskop - Slack Bot Integration Tests\nperiskop is an integration testing tool for slack bots. An increasing diverse set of use-cases are implemented with chat bots e.g. ChatOps, Service Desk, etc. \nWith periskop we can implement and run integration tests using a simple yaml file.\n\nHere's a quick example of the power of periskop:\n```\ntest_name: chatops_diskspace\nbot_name: mrrobot\ntimeout: 60\nslack:\n  channel: \"#periskop-test\"\n  as_user: periskop-user\n  text: \"!diskspace mymachine /var\"\nexpect:\n  regex: true\n  attachments:\n    text: |\n      .*{u'failures': 0, u'skipped': 1, u'ok': 3, u'unreachable': 0, u'changed': 1}.*\n```\nThis test `chatops_diskspace` executes the command `!diskspace mymachine /var` in the channel `#periskop-test` as user `periskop-user` and checks for the result in an attachment. The result is a string with regular expression matching.\n\n## Getting Started\nInstall periskop:\n```\npip install periskop\n```\n\nCheck for successfull installation.\n```\nperiskop --help\n```\n\nCreate a config file `config.yml` with the necessary information to run tests:\n```\nslack_token: abcd-efgh-...-...\nas_user: myusername\nbot_name: mybotname\nchannel: \"#periskop\"\n```\nMake sure that the slack token is a valid API Tester token. We need this kind of token, because bots can't talk to other bots :).\n\nCreate your first test `firsttest.yml`:\n```\ntest_name: chatops_diskspace\nbot_name: mrrobot\ntimeout: 60\nslack:\n  text: \"!diskspace mymachine /var\"\nexpect:\n  regex: true\n  attachments:\n    text: |\n      .*{u'failures': 0, u'skipped': 1, u'ok': 3, u'unreachable': 0, u'changed': 1}.*\n```\n\nList all tests:\n```\nperiskop list\n```\n\nRun the test:\n```\nperiskop run firsttest\n```\n\n## Test Implementation\n\n### Slack Input\nIn the examples above we specified the following simple slack command:\n```\nslack:\n  text: \"!diskspace mymachine /var\"\n```\nWe can not only specify text but use the full set of arguments defined here: [Slack PostMessage API](https://api.slack.com/methods/chat.postMessage#arguments)\n\n### Test Condition\nWe can test either for a full text match or for regex. The test allows for specification of the complete [message event type](https://api.slack.com/events/message). \nInstead of checking for the attachment you may as well check for the text:\n```\nexpect:\n  regex: true\n  text: |\n    .*ok.*\n```\n\n#### RegEx\n```\ntest_name: chatops_diskspace\nbot_name: mrrobot\ntimeout: 60\nslack:\n  channel: \"#periskop\"\n  as_user: periskop-user\n  text: \"!diskspace mymachine /var\"\nexpect:\n  regex: true\n  attachments:\n    text: |\n      .*{u'failures': 0, u'skipped': 1, u'ok': 3, u'unreachable': 0, u'changed': 1}.*\n```\n\n#### Full match\n```\ntest_name: status command\nbot_name: mrrobot\ntimeout: 300\nslack:\n  channel: \"#periskop\"\n  as_user: periskop-user\n  text: \"!status mymachine\"\nexpect:\n  attachments:\n    text: |\n      ```\u003chttp://mymachine\u003e | SUCCESS =\u0026gt; {\\n    \"changed\": false, \\n    \"ping\": \"pong\"\\n}```\n  text: \"@mrrobot: Here is your status for `\u003chttp://mymachine\u003e` host(s):\"`\n```\n\n\n## Setup Development Environment\n```\ngit clone https://github.com/unic/periskop.git\npython setup.py develop\n```\n\n### PyPi\nIf you want to update the PyPi package, make sure you have a valid `~/.pypirc` configuration:\n```\n[distutils]\nindex-servers =\n  pypi\n  pypitest\n\n[pypi]\nrepository=https://pypi.python.org/pypi\nusername=your_username\npassword=your_password\n\n[pypitest]\nrepository=https://testpypi.python.org/pypi\nusername=your_username\npassword=your_password\n```\n\nThen execute\n```\npip install pypandoc\nbrew install pandoc\npython setup.py register -r pypi\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funic%2Fperiskop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funic%2Fperiskop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funic%2Fperiskop/lists"}