Bug 697252

Summary: TCMS - nitrate xmlrpc: failed to attach bug info to TestCaseRun
Product: [Other] TCMS Reporter: Max Benenson <mbenenso>
Component: ApplicationAssignee: Yuguang Wang <yuwang>
Status: VERIFIED --- QA Contact: Nobody <nobody>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.4CC: junzhang, jzhao, oramraz, ryang, vchen
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: 3.5.0-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Max Benenson 2011-04-17 08:41:51 UTC
Description of problem:
Using TestCaseRun.attach_bug verb I am getting an error:

NameError: global name 'trc' is not defined

I think there is a typo in testcaserun.py code (should be "tcr").
I am using the stage server at https://tcms-stage.englab.bne.redhat.com/xmlrpc/

Steps to Reproduce:
1. nitrate.do_command("TestCaseRun.attach_bug", [{"case_run_id": 475406, "bug_id": 690069, "bug_system_id": 1, "summary": "test", "description": "test"}])
  
Actual results:
See additional info

Expected results:
Should attach the bug info to the TestCaseRun

Additional info:
<?xml version='1.0'?>
<methodResponse>
<fault>
<value><struct>
<member>
<name>faultCode</name>
<value><int>1</int></value>
</member>
<member>
<name>faultString</name>
<value><string>Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/kobo/django/xmlrpc/dispatcher.py", line 94, in _marshaled_dispatch
    response = self._dispatch(method, params)
  File "/usr/lib64/python2.4/SimpleXMLRPCServer.py", line 406, in _dispatch
    return func(*params)
  File "/usr/lib/python2.4/site-packages/kobo/django/xmlrpc/decorators.py", line 91, in _new_function
    return function(request, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/kobo/django/xmlrpc/decorators.py", line 31, in _new_func
    return func(request, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/tcms/xmlrpc/testcaserun.py", line 147, in attach_bug
    trc.add_bug(
NameError: global name 'trc' is not defined
Frame attach_bug in /usr/lib/python2.4/site-packages/tcms/xmlrpc/testcaserun.py at line 147
&lt;CODE&gt;
     140         try:
     141             bug_system = TestCaseBugSystem.objects.get(id = value['bug_system_id'])
     142         except:
     143             raise
     144         
     145         try:
     146             tcr = TestCaseRun.objects.get(case_run_id = value['case_run_id'])
--&gt;  147             trc.add_bug(
     148                 bug_id = value['bug_id'],
     149                 bug_system = bug_system,
     150                 summary = value.get('summary'),
     151                 description = value.get('description')
     152             )
     153         except:

Comment 1 Yuguang Wang 2011-05-05 10:38:46 UTC
*** Bug 691680 has been marked as a duplicate of this bug. ***

Comment 2 Oded Ramraz 2011-06-23 15:58:08 UTC
Raising the severity of this issue.
IMO This feature is very basic / important for QA needs.

Comment 3 Yuguang Wang 2011-07-01 03:18:07 UTC
Will include the fix in 3.5, please wait for new version online.

Sorry for inconvenience.

Comment 4 Jin Zhao 2011-07-14 02:29:55 UTC
Verify 3.5.0-1 on stage -->PASS

>>>from nitrate import NitrateKerbXmlrpc
>>>handle=NitrateKerbXmlrpc('https://tcms-stage.englab.bne.redhat.com/xmlrpc/')
>>>handle.server.TestCaseRun.attach_bug({'case_run_id':545636,'bug_id':123456,'bug_system_id': 1})

Actual result: Can add bug 123456 to testcase-run 545636.