This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
122 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
sudo: false | ||
language: python | ||
services: | ||
- memcached | ||
- postgresql | ||
- redis-server | ||
python: | ||
- "2.7" | ||
cache: | ||
directories: | ||
- node_modules | ||
- $HOME/.cache/pip | ||
deploy: | ||
provider: pypi | ||
user: getsentry | ||
password: | ||
secure: NMwOI1H9arp2vbgaidx9OY6y8990hiu0WsHtowEvEdGKXNzAQcy0sW3SoKcB6FN0bk11xhj49+5C++KAwMYwE/SL8Y5OoZ1/iYVI4/XlWNukr+1/pfPKVMgw3v5W+pL5Ba9TBdFfIoFPNYUDPLItSSjg94Bm95034gBkYWC5Hl0= | ||
on: | ||
tags: true | ||
distributions: 'sdist bdist_wheel' | ||
env: | ||
global: | ||
- PIP_DOWNLOAD_CACHE=".pip_download_cache" | ||
install: | ||
- make develop | ||
script: | ||
- PYFLAKES_NODOCTEST=1 flake8 src | ||
- py.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
Copyright (c) 2016, Functional Software, Inc | ||
Copyright (c) 2013, Adam Thurlow | ||
All rights reserved. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.PHONY: clean develop install-tests lint publish test | ||
|
||
develop: | ||
pip install "pip>=7" | ||
pip install -e . | ||
make install-tests | ||
|
||
install-tests: | ||
pip install .[tests] | ||
|
||
lint: | ||
@echo "--> Linting python" | ||
flake8 | ||
@echo "" | ||
|
||
test: | ||
@echo "--> Running Python tests" | ||
py.test tests || exit 1 | ||
@echo "" | ||
|
||
publish: | ||
python setup.py sdist bdist_wheel upload | ||
|
||
clean: | ||
rm -rf *.egg-info src/*.egg-info | ||
rm -rf dist build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import absolute_import | ||
|
||
pytest_plugins = [ | ||
'sentry.utils.pytest' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[wheel] | ||
universal = 1 | ||
|
||
[pytest] | ||
python_files = test*.py | ||
addopts = --tb=native -p no:doctest | ||
norecursedirs = bin dist docs htmlcov script hooks node_modules .* {args} | ||
|
||
[flake8] | ||
ignore = F999,E501,E128,E124,E402,W503,E731,C901 | ||
max-line-length = 100 | ||
exclude = .tox,.git,*/migrations/*,node_modules/*,docs/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from __future__ import absolute_import | ||
|
||
import responses | ||
|
||
from django.http import HttpRequest | ||
from exam import fixture | ||
from sentry.models import GroupMeta | ||
from sentry.testutils import TestCase | ||
|
||
from sentry_jira.plugin import JIRAPlugin | ||
|
||
|
||
class JIRAPluginTest(TestCase): | ||
@fixture | ||
def plugin(self): | ||
return JIRAPlugin() | ||
|
||
# TODO(dcramer): assert request body | ||
# TODO(dcramer): pull full fixture from JIRA | ||
@responses.activate | ||
def test_create_issue(self): | ||
responses.add('POST', 'https://jira.atlassian.com/rest/api/2/issue', | ||
json={"key": "JIRA-1234"}) | ||
|
||
self.plugin.set_option('instance_url', 'https://jira.atlassian.com', self.project) | ||
self.plugin.set_option('username', 'example', self.project) | ||
self.plugin.set_option('password', 'example', self.project) | ||
|
||
request = HttpRequest() | ||
group = self.create_group(message='Hello world', culprit='foo.bar') | ||
event = self.create_event(group=group, message='Hello world') | ||
|
||
form_data = { | ||
|
||
} | ||
|
||
with self.options({'system.url-prefix': 'http://example.com'}): | ||
response = self.plugin.create_issue(request, group, form_data) | ||
|
||
assert response == ('JIRA-1234', None) |