Skip to content

Commit

Permalink
Codebeamer-lobster supports CB-API V3
Browse files Browse the repository at this point in the history
The used codebeamer endpoints are updated and
one unit-test has been added.

Resolves #49
  • Loading branch information
TannazVhdBMWExt committed Aug 1, 2024
1 parent 64ebebe commit 21052d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
This allows to have multiple json elements with the same name in
different source files

* The `lobster-codebeamer` tool now uses codebeamer api v3
* The `lobster-codebeamer` tool now uses codebeamer api v3.
Please note that the api v3 returns the value "Unset" for a codebeamer
item status if the status is actually empty. The api v1 did not return
any value at all for an item with a missing status. This means that the
resulting lobster file will now contain "Unset" as status information,
too, instead of `Null`.

* The `lobster-html-report` tool now supports argument `--dot` to specify
the path to the graphviz dot utility instead of expecting it in PATH
Expand Down
10 changes: 6 additions & 4 deletions lobster/tools/codebeamer/codebeamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def query_cb_single(cb_config, url):
def get_single_item(cb_config, item_id):
assert isinstance(item_id, int) and item_id > 0

url = "%s/items/%u" % (cb_config["base"], item_id)
url = "%s/items/%u" % (cb_config["base"],
item_id)
data = query_cb_single(cb_config, url)
return data

Expand Down Expand Up @@ -157,8 +158,9 @@ def to_lobster(cb_config, cb_item):
# This looks like it's business logic, maybe we should make this
# configurable?

if "typeName" in cb_item:
kind = cb_item["typeName"]
categories = cb_item.get("categories")
if categories:
kind = categories[0].get("name", "codebeamer item")
else:
kind = "codebeamer item"

Expand Down Expand Up @@ -201,7 +203,7 @@ def import_tagged(mh, cb_config, items_to_import):
assert isinstance(mh, Message_Handler)
assert isinstance(cb_config, dict)
assert isinstance(items_to_import, set)
rv = []
rv = []

cb_items = get_many_items(cb_config, items_to_import)
for cb_item in cb_items:
Expand Down
7 changes: 3 additions & 4 deletions test-unit/lobster-codebeamer/test_codebeamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class QueryCodebeamerTest(unittest.TestCase):

def _assertListEqualByAttributes(self, list1, list2):
self.assertEqual(len(list1), len(list2), "Lists length are not the same")
for obj1, obj2 in zip(list1, list2):
Expand Down Expand Up @@ -63,15 +62,15 @@ def test_import_tagged(self, mock_get):
{
'id': 24406947,
'name': 'Test name 1',
'typeName': 'Requirement',
'categories': [{'name': 'Folder'}],
'version': 7,
'status': {'name': 'status'},
'tracker': {'id': 123}
},
{
'id': 21747817,
'name': 'Test name 2',
'typeName': 'Requirement',
'categories': [{'name': 'Folder'}],
'version': 10,
'status': {'name': 'status'},
'tracker': {'id': 123}
Expand All @@ -93,4 +92,4 @@ def test_import_tagged(self, mock_get):


if __name__ == '__main__':
unittest.main()
unittest.main()

0 comments on commit 21052d1

Please sign in to comment.