Skip to content

Commit acddbc3

Browse files
author
Luiko Czub
committed
correct online utest uploadTestCaseAttachment
online utests *test_uploadTestCaseAttachment_unknownID* failed with default Travis config against TL demo project. reason was, that this tests expects, that no *nodes_hierarchy* entry with id 4712 exist, but the TL demo project has this. -> so this test creates unwanted attachment upload into the TL demo project To avoid this following is changed: - uploadTestCaseAttachment_unknownID uses now the ID '0000' - tox.ini and .travis.yml suggest to use TL demo project with special use *pyTLapi* instead *admin*
1 parent e8287b2 commit acddbc3

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ install:
1515
# online tests uses TL connection, defined in
1616
# TESTLINK_API_PYTHON_DEVKEY and TESTLINK_API_PYTHON_SERVER_URL
1717
# see https://travis-ci.org/USER/TestLink-API-Python-client/settings/env_vars
18-
# suggestion: use TL demo project
18+
# suggestion: use TL demo project with user pyTLapi, see tox.ini
1919
script:
2020
- py.test test/utest-offline
2121
- if [[ $TESTLINK_API_PYTHON_SERVER_URL ]]; then py.test test/utest-online; fi

test/utest-online/testlinkapi_generic_online_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ def test_uploadTestCaseAttachment_unknownID(self):
278278

279279
def test_uploadAttachment_unknownID(self):
280280
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
281-
with self.assertRaisesRegex(TLResponseError, '6004.*4712'):
282-
self.client.uploadAttachment(attachemantFile, 4712, 'nodes_hierarchy',
281+
with self.assertRaisesRegex(TLResponseError, '6004.*Invalid Foreign Key ID'):
282+
self.client.uploadAttachment(attachemantFile, '0000', 'nodes_hierarchy',
283283
title='title 4713', description='descr. 4714')
284284

285285
def test_testLinkVersion(self):

test/utest-online/testlinkapi_online_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ def test_uploadTestCaseAttachment_unknownID(self):
268268

269269
def test_uploadAttachment_unknownID(self):
270270
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
271-
with self.assertRaisesRegex(TLResponseError, '6004.*4712'):
272-
self.client.uploadAttachment(attachemantFile, 4712, 'nodes_hierarchy',
271+
with self.assertRaisesRegex(TLResponseError, '6004.*Invalid Foreign Key ID'):
272+
self.client.uploadAttachment(attachemantFile, '0000', 'nodes_hierarchy',
273273
title='title 4713', description='descr. 4714')
274274

275275
def test_testLinkVersion(self):

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# content of: tox.ini , put in same dir as setup.py
2-
# disabled online tests for travis-ci. enable it for local runs!
3-
# default target for online test - testlink demo application with user admin
4-
# - to use your own local testlink application and use, define env
2+
# default target for online test - testlink demo application with user pyTLapi
3+
# - to use your own local testlink application, define environment variables
54
# TESTLINK_API_PYTHON_DEVKEY and TESTLINK_API_PYTHON_SERVER_URL
5+
# with your server settings
66
[tox]
77
envlist = py26,py27,py33,py34
88
[testenv]
99
deps=pytest
1010
py26: unittest2
1111
py26: argparse
1212
setenv=
13-
TESTLINK_API_PYTHON_DEVKEY={env:TESTLINK_API_PYTHON_DEVKEY:7ed95d2312a63a52ba991d6f6f9cf56d}
13+
TESTLINK_API_PYTHON_DEVKEY={env:TESTLINK_API_PYTHON_DEVKEY:3ec96581bb3d8a34cd28ce338b641063}
1414
TESTLINK_API_PYTHON_SERVER_URL={env:TESTLINK_API_PYTHON_SERVER_URL:http://demo.testlink.org/latest/lib/api/xmlrpc/v1/xmlrpc.php}
1515
commands=
1616
py.test --junitxml={envlogdir}/pyunit-offline-{envname}.xml test/utest-offline

0 commit comments

Comments
 (0)