Skip to content

Commit

Permalink
Renamed field from tmtuuid to tmtid
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Matyas committed Jul 9, 2024
1 parent 3794378 commit 6677d01
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ Test type, Tags, Importance, Status, Linked BZs and possibly more
in the future.
Also a unique id generated by tmt (automatically during export) is
added into Notes (Nitrate) or tmt UUID (Polarion) fields for
added into Notes (Nitrate) or tmt ID (Polarion) fields for
matching cases across all test case management systems.
Configuration and guide for setting up nitrate can be found
Expand Down
2 changes: 1 addition & 1 deletion docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
tmt-1.35
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change of Polarion field to store tmt id. Now using 'tmt UUID' field,
Change of Polarion field to store tmt id. Now using 'tmt ID' field,
specifically created for this purpose instead of 'Test Case ID' field.

tmt-1.34
Expand Down
12 changes: 6 additions & 6 deletions tmt/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,24 +897,24 @@ def read_polarion_case(

# Set tmt id if available in Polarion, otherwise generate
try:
UUID(polarion_case.tmtuuid)
uuid = str(polarion_case.tmtuuid)
UUID(polarion_case.tmtid)
uuid = str(polarion_case.tmtid)
except (AttributeError, TypeError, ValueError):
try:
UUID(polarion_case.test_case_id)
uuid = str(polarion_case.test_case_id)
except (TypeError, ValueError):
uuid = str(uuid4())
if not dry_run:
polarion_case.tmtuuid = uuid
polarion_case.tmtid = uuid
polarion_case.update()
# Check if it was really uploaded
polarion_case.tmtuuid = ''
polarion_case.tmtid = ''
polarion_case.reload()
if not polarion_case.tmtuuid:
if not polarion_case.tmtid:
echo(style(
f"Can't add ID because {polarion_case.project_id} project "
"doesn't have tmtuuid field defined",
"doesn't have tmtid field defined",
fg='yellow'))
current_data[tmt.identifier.ID_KEY] = uuid
echo(style('ID: ', fg='green') + uuid)
Expand Down
10 changes: 5 additions & 5 deletions tmt/export/polarion.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,17 @@ def export_to_polarion(test: tmt.base.Test) -> None:
if not uuid:
uuid = test.node.get(ID_KEY)
if not dry_mode:
polarion_case.tmtuuid = uuid
polarion_case.tmtid = uuid
polarion_case.update() # upload the ID first so the case can be found in case of errors
# Check if it was really uploaded
polarion_case.tmtuuid = ''
polarion_case.tmtid = ''
polarion_case.reload()
if not polarion_case.tmtuuid:
if not polarion_case.tmtid:
echo(style(
f"Can't add ID because {polarion_case.project_id} project "
"doesn't have tmtuuid field defined",
"doesn't have tmtid field defined",
fg='yellow'))
if dry_mode or polarion_case.tmtuuid:
if dry_mode or polarion_case.tmtid:
echo(style(f"Append the ID {uuid}.", fg='green'))

# Description
Expand Down

0 comments on commit 6677d01

Please sign in to comment.