Esempio n. 1
0
# coding: utf8
import pytest
import sys

from atlassian import ServiceDesk

SERVICEDESK = None
try:
    from .mockup import mockup_server

    SERVICEDESK = ServiceDesk("{}/servicedesk".format(mockup_server()),
                              username="******",
                              password="******",
                              cloud=True)
except ImportError:
    pass


class TestBasic:
    @pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
    def test_create_customer(self):
        result = SERVICEDESK.create_customer("{displayName}",
                                             "{emailAddress}")["emailAddress"]
        assert result == "{emailAddress}", "Result of [create_customer()]"

    @pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
    def test_get_organisations(self):
        result = [x["name"] for x in SERVICEDESK.get_organisations()["values"]]
        assert result == ["Charlie Cakes Franchises"
                          ], "Result of [get_organisations()]"
Esempio n. 2
0
 def test_init_service_desk(self):
     ServiceDesk(url=SERVICE_DESK_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD)
Esempio n. 3
0
from atlassian import ServiceDesk

# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
import json

# TODO: Replace Service Desk URL with the url of your JIRA service desk instance.
# TODO: Replace username and password with JIRA Service Desk username and password.
sd = ServiceDesk(url='https://example-desk.atlassian.net/',
                 username='******',
                 password='******')


def get_sd_id():
    return sd.get_service_desks()[1]["id"]


def create_request(values: dict, requestForEmail: str):

    # For more information on the information requried for this API call look at the Usage section of the README
    return sd.create_customer_request(get_sd_id(), "9", values,
                                      requestForEmail)