Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem attaching a .png file via TestLink integration #162

Open
WilliamMega opened this issue Jun 2, 2023 · 2 comments
Open

Problem attaching a .png file via TestLink integration #162

WilliamMega opened this issue Jun 2, 2023 · 2 comments

Comments

@WilliamMega
Copy link

Here's code:

def update_Status_TestCase(TestCaseName, Status):

tl_helper = TestLinkHelper()
myTestLink = tl_helper.connect(TestlinkAPIClient)

DateExec = datetime.today().strftime('%Y-%m-%d %H:%M:%S')

TestPlan = myTestLink.getTestPlanByName(Projeto, TestPlanName)
TestPlanID = TestPlan[0]['id']
Test = myTestLink.getTestCaseIDByName(TestCaseName)
TestCaseID = Test[0]['id']
TCExternalID = Test[0]['tc_external_id']

newResult = myTestLink.reportTCResult(
                   TestCaseID,
                   TestPlanID,
                   BuildName,
                   Status,
                   Note,
                   user=user,
                   overwrite=OverWrite
                   )

TestCaseName = TestCaseName + ".png"
ROOT_DIR = os.path.abspath(os.curdir)
ROOT_DIR = os.path.join(ROOT_DIR, "screenshot", TestCaseName)

newResultID_B_f = newResult[0]['id']

a_file_path=open(ROOT_DIR, mode='rb')
newAttachment = myTestLink.uploadExecutionAttachment(a_file_path, newResultID_B_f,
                             'Attachment', 'Attachment Test')

Following error message:

Several failures occurred:

  1. TLResponseError: 6002: (uploadExecutionAttachment) - Error inserting attachment on DB
    uploadExecutionAttachment({'filename': 'Caixa - Forma de Pagamento PIX com Sitef.png', 'filetype': 'image/png', 'content': b'iVBORw0KGgoAAAANSUhEUgAADSAAAARtCAIAAABwBZ0FAAEAAElEQVR4nOy9eZwdVZn//zznVNW9\nt/fu7IE0ZAMCISGARBPURJYhSUMIDqKMjmiEDDOyzFeYrxtOFL7jAioJM8MP+GYUdXDAr2KkSRRE\ngmMyRCMhEQiQEDQQyNZZer9Vdc7z++NU1a279b7cTp43/Wrq1nZOnfrU6Uo/n34eBIZhGIZhGIZh\nGIZhGIZhGIYZBC4+6TrE4e4EU3oQkQYFAIiIMYkQUfS9i6MBut6h62MhT5IIgAgiWs7dFPSwP+0y\nxzNEQIFyMgpBRAACJCIiUmbHbAlR7Ii+TZRF9EwAeXpGxGx5EwDw/Hz8EhebKLQDhlLJEQERkAYP\ngBCh9/Nzf+hqfqbYkxL2SpgFRCQiAD1oHWNKmYLyjiACTaBz5BEJ20zQg9Mx1jPTB7rTM2kNasjn\n50ivcVlGbxTRj5IsJYcIft843jlu3jcMeatj8jadtAatWwzDMAzDMAzDMAzDMAzDMAzDML1gMKMp\nDDN45OqWyEQcB8+9wTBDDYuZOT6IlMySZo4DWMbM8Ucpq5oNdgzDMAzDMAzDMAzDMAzDMAzDDCEI\nCLmJCqAUoymInHOD6SsEBFQSiQ9ZxkxxIn1i9H+MJVcs4fmZYfoO65kZkcTm55zJuTR+0PNrM9MF\nx8n7BhvsGIZhGIZhGIZhGIZhGIZhmEGBgyxMMSKLXU40Jfo47CG6Ye8AM2II1IwQ13Mmfd0wF0cr\nqOSggi1zghOVv85djUaypTM/m+KZBUu6lXgknhl2WM/McQMCIAoKihtnSWUIlVO0jm3BJ4nfNxiA\nkfS+UYyoJ2ywYxiGYRiGYRiGYRiGYRiGYRhm6MmJoQQfuz1qcDsFAKUUzmFGEKGCjUR1VCUWAAoa\nKQafArlkwjUc7WZyoPB74SB3Sfl+8oRdQn1jhpaub31mK+uZGQn0VM/B55iMB/PFtTuHHAIAYt57\nDr9vMEUYSe8b+fJmgx3DMAzDMAzDMAzDMAzDMAzDMEMPxUIskL3AMCMaPdwdYJg+my14HmZGECxX\n5niixPXchx8rJX5FzIBwHL9vFMjX...
    [ Message content over the limit has been removed. ]

Note: The image is attached to the TestLink, but the Test Case fails, and the Test Case was successful, generating a false positive.

I point out that the attachment is being attached, but it is generating this error message.

@nguyenquangtay
Copy link

hi @WilliamMega
Not sure you've solved this but.
I think the problem comes from the name of the uploading_file,
I have the same problem and can solve it by changing to simple and short names before calling API upload attachments.
( you can test error by directly uploading that file on Testlink)
image

Hope this helps!

@Alexandremjp
Copy link

Alexandremjp commented Oct 11, 2024

You are correct ! This come from configuration $tlCfg->attachments->allowed_files = 'doc,xls,gif,png,jpg';
If you trying to upload a file with an not granted extention ! The call python side is KO with that error so check config.inc.php is correct and with 1.9.20_fixed version currently (Oct 2024) this work !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants