From cdf3baf9cbd03cb5eea62dc6ed16303a9f13e021 Mon Sep 17 00:00:00 2001 From: Robert Habermann <mail@rhab.de> Date: Sat, 23 Apr 2016 18:53:03 +0200 Subject: [PATCH] extend tests --- pyotrs/lib.py | 104 --------------------------------- pyotrs/version.py | 2 +- tests/test_pyotrs_responses.py | 25 -------- tox.ini | 13 +++++ 4 files changed, 14 insertions(+), 130 deletions(-) diff --git a/pyotrs/lib.py b/pyotrs/lib.py index 23c5500..8575845 100644 --- a/pyotrs/lib.py +++ b/pyotrs/lib.py @@ -196,58 +196,6 @@ class Attachment(object): """ return Attachment("YmFyCg==", "text/plain", "dümmy.txt") -# -# class AttachmentList(object): -# """PyOTRS Attachment class """ -# def __init__(self, attachments=None): -# attachment_list = [] -# if isinstance(attachments, Attachment): -# attachment_list.append(attachments) -# elif isinstance(attachments, list): -# for item in attachments: -# attachment_list.append(item) -# -# self.attachment_list = attachment_list -# -# def __iter__(self): -# for item in self.attachment_list: -# yield item -# -# def __repr__(self): -# return "<{0}: {1} item(s)>".format(self.__class__.__name__, len(self.attachment_list)) -# -# def add(self, attachment): -# """add Attachment to AttachmentList -# -# Args: -# attachment: -# -# Returns: -# -# """ -# self.attachment_list.append(attachment) -# -# def to_dct(self): -# """represent AttachmentList and related Attachment objects as dict -# -# Returns: -# -# """ -# _lst = [] -# for attachments in self: -# _lst.append(attachments.__dict__) -# return {"Attachment": _lst} -# -# @classmethod -# def dummy(cls): -# """dummy data (for testing) -# -# Returns: -# -# """ -# return AttachmentList(Attachment.dummy()) - - class DynamicField(object): """PyOTRS DynamicField class """ @@ -293,58 +241,6 @@ class DynamicField(object): """ return DynamicField(dct={'Name': 'lastname', 'Value': 'Doe'}) -# -# class DynamicFieldList(object): -# """PyOTRS DynamicFieldList class """ -# def __init__(self, dynamic_field_dicts=None): -# dynamic_field_list = [] -# if isinstance(dynamic_field_dicts, DynamicField): -# dynamic_field_list.append(dynamic_field_dicts) -# elif isinstance(dynamic_field_dicts, list): -# for item in dynamic_field_dicts: -# dynamic_field_list.append(item) -# -# self.dynamic_field_list = dynamic_field_list -# -# def __iter__(self): -# for item in self.dynamic_field_list: -# yield item -# -# def __repr__(self): -# return "<{0}: {1} item(s)>".format(self.__class__.__name__, len(self.dynamic_field_list)) -# -# def add(self, dynamic_field): -# """add DynamicField object to DynamicFieldList -# -# Args: -# dynamic_field (DynamicField): -# -# Returns: -# -# """ -# self.dynamic_field_list.append(dynamic_field) -# -# def to_dct(self): -# """represent DynamicFieldList and related DynamicField objects as dict -# -# Returns: -# """ -# _lst = [] -# for dynamic_field in self: -# _lst.append(dynamic_field.to_dct()) -# return {"DynamicField": _lst} -# -# @classmethod -# def dummy(cls): -# """dummy data (for testing) -# -# Returns: -# -# """ -# return DynamicFieldList([DynamicField(name="firstname", value="Jane"), -# DynamicField(dct={'Name': 'lastname', 'Value': 'Doe'})]) - - class Ticket(object): """PyOTRS Ticket class """ diff --git a/pyotrs/version.py b/pyotrs/version.py index 3227311..f77af56 100644 --- a/pyotrs/version.py +++ b/pyotrs/version.py @@ -4,5 +4,5 @@ # 3) we can import it into your module module """ -__version_info__ = ('0', '4', '0') +__version_info__ = ('0', '5', '0') __version__ = '.'.join(__version_info__) diff --git a/tests/test_pyotrs_responses.py b/tests/test_pyotrs_responses.py index 5395ea8..bd2fea4 100644 --- a/tests/test_pyotrs_responses.py +++ b/tests/test_pyotrs_responses.py @@ -362,31 +362,6 @@ class PyOTRSResponsesTests(unittest.TestCase): self.assertEqual(obj.operation, 'TicketUpdate') self.assertEqual(mock_validate_resp.call_count, 1) - """ - def test_my_api_mocked(self): - with responses.RequestsMock() as rsps: - rsps.add(responses.GET, - 'http://localhost', - body='{}', - status=302, - content_type='text/html') - rsps.add(responses.GET, - 'https://localhost', - body='This is Sparta', - status=200, - content_type='text/html') - requests.get('http://localhost') - resp = requests.get('https://localhost') - print(resp.content) - # self.assertEqual(resp.status_code, 200) - - def test_my_api_real(self): - # outside the context manager requests will hit the remote server - resp = requests.get('http://localhost') - self.assertEqual(resp.status_code, 200) - - """ - # Main def main(): diff --git a/tox.ini b/tox.ini index 81a0ec1..98ed8f8 100644 --- a/tox.ini +++ b/tox.ini @@ -82,6 +82,19 @@ whitelist_externals = commands = sudo cp -a {toxinidir}/htmlcov /var/www/PyOTRS/ + +# -------------------------------------------------------------------- +# Lint +# -------------------------------------------------------------------- +[testenv:wheel] +skip_install = True +commands = python setup.py bdist_wheel + +[testenv:sdist] +skip_install = True +commands = python setup.py sdist + + # -------------------------------------------------------------------- # Lint # -------------------------------------------------------------------- -- GitLab