bugdantic 0.4.4__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bugdantic-0.4.4 → bugdantic-0.5.0}/PKG-INFO +1 -1
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic/bugzilla.py +39 -9
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic.egg-info/PKG-INFO +1 -1
- {bugdantic-0.4.4 → bugdantic-0.5.0}/pyproject.toml +1 -1
- {bugdantic-0.4.4 → bugdantic-0.5.0}/test/test_bugzilla.py +31 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/LICENSE +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/README.md +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic/__init__.py +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic/py.typed +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic/userstory.py +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic.egg-info/SOURCES.txt +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic.egg-info/dependency_links.txt +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic.egg-info/requires.txt +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/bugdantic.egg-info/top_level.txt +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/setup.cfg +0 -0
- {bugdantic-0.4.4 → bugdantic-0.5.0}/test/test_userstory.py +0 -0
|
@@ -564,11 +564,17 @@ class Bugzilla:
|
|
|
564
564
|
bug_id: int,
|
|
565
565
|
bug_type: type[BugType],
|
|
566
566
|
include_fields: Optional[list[str]] = None,
|
|
567
|
+
exclude_fields: Optional[list[str]] = None,
|
|
567
568
|
) -> Optional[BugType]:
|
|
568
569
|
"""Get a single bug specified by id"""
|
|
569
570
|
|
|
570
571
|
data = self.check_error(
|
|
571
|
-
self.request(
|
|
572
|
+
self.request(
|
|
573
|
+
"GET",
|
|
574
|
+
f"bug/{bug_id}",
|
|
575
|
+
include_fields=include_fields,
|
|
576
|
+
exclude_fields=exclude_fields,
|
|
577
|
+
)
|
|
572
578
|
)
|
|
573
579
|
search_result = bug_search_model(bug_type).model_validate(data)
|
|
574
580
|
if search_result.faults:
|
|
@@ -580,18 +586,27 @@ class Bugzilla:
|
|
|
580
586
|
return bugs[0]
|
|
581
587
|
|
|
582
588
|
def bug(
|
|
583
|
-
self,
|
|
589
|
+
self,
|
|
590
|
+
bug_id: int,
|
|
591
|
+
include_fields: Optional[list[str]] = None,
|
|
592
|
+
exclude_fields: Optional[list[str]] = None,
|
|
584
593
|
) -> Optional[Bug]:
|
|
585
|
-
return self._bug(bug_id, Bug, include_fields)
|
|
594
|
+
return self._bug(bug_id, Bug, include_fields, exclude_fields)
|
|
586
595
|
|
|
587
|
-
def bug_as(
|
|
596
|
+
def bug_as(
|
|
597
|
+
self,
|
|
598
|
+
bug_id: int,
|
|
599
|
+
bug_type: type[BugType],
|
|
600
|
+
exclude_fields: Optional[list[str]] = None,
|
|
601
|
+
) -> Optional[BugType]:
|
|
588
602
|
include_fields = model_field_names(bug_type)
|
|
589
|
-
return self._bug(bug_id, bug_type, include_fields)
|
|
603
|
+
return self._bug(bug_id, bug_type, include_fields, exclude_fields)
|
|
590
604
|
|
|
591
605
|
def bugs(
|
|
592
606
|
self,
|
|
593
607
|
bug_ids: Sequence[int],
|
|
594
608
|
include_fields: Optional[list[str]] = None,
|
|
609
|
+
exclude_fields: Optional[list[str]] = None,
|
|
595
610
|
page_size: int = 100,
|
|
596
611
|
) -> list[Bug]:
|
|
597
612
|
"""Get multiple bugs specified by id"""
|
|
@@ -603,6 +618,7 @@ class Bugzilla:
|
|
|
603
618
|
self.search(
|
|
604
619
|
{"id": ",".join(str(id) for id in bug_ids_chunk)},
|
|
605
620
|
include_fields=include_fields,
|
|
621
|
+
exclude_fields=exclude_fields,
|
|
606
622
|
)
|
|
607
623
|
)
|
|
608
624
|
return results
|
|
@@ -611,6 +627,7 @@ class Bugzilla:
|
|
|
611
627
|
self,
|
|
612
628
|
bug_ids: Sequence[int],
|
|
613
629
|
bug_type: type[BugType],
|
|
630
|
+
exclude_fields: Optional[list[str]] = None,
|
|
614
631
|
page_size: int = 100,
|
|
615
632
|
) -> list[BugType]:
|
|
616
633
|
"""Get multiple bugs specified by id"""
|
|
@@ -622,6 +639,7 @@ class Bugzilla:
|
|
|
622
639
|
self.search_as(
|
|
623
640
|
{"id": ",".join(str(id) for id in bug_ids_chunk)},
|
|
624
641
|
bug_type,
|
|
642
|
+
exclude_fields,
|
|
625
643
|
)
|
|
626
644
|
)
|
|
627
645
|
return results
|
|
@@ -650,6 +668,7 @@ class Bugzilla:
|
|
|
650
668
|
bug_type: type[BugType],
|
|
651
669
|
query: QueryParams,
|
|
652
670
|
include_fields: Optional[list[str]] = None,
|
|
671
|
+
exclude_fields: Optional[list[str]] = None,
|
|
653
672
|
page_size: int = 100,
|
|
654
673
|
) -> list[BugType]:
|
|
655
674
|
"""Search for bugs using the bugzilla query API"""
|
|
@@ -665,7 +684,13 @@ class Bugzilla:
|
|
|
665
684
|
results: list[BugType] = []
|
|
666
685
|
while True:
|
|
667
686
|
response = self.check_error(
|
|
668
|
-
self.request(
|
|
687
|
+
self.request(
|
|
688
|
+
"GET",
|
|
689
|
+
"bug",
|
|
690
|
+
params=query,
|
|
691
|
+
include_fields=include_fields,
|
|
692
|
+
exclude_fields=exclude_fields,
|
|
693
|
+
)
|
|
669
694
|
)
|
|
670
695
|
search_result = bug_search_model(bug_type).model_validate(response)
|
|
671
696
|
if search_result.faults:
|
|
@@ -689,15 +714,20 @@ class Bugzilla:
|
|
|
689
714
|
self,
|
|
690
715
|
query: QueryParams,
|
|
691
716
|
include_fields: Optional[list[str]] = None,
|
|
717
|
+
exclude_fields: Optional[list[str]] = None,
|
|
692
718
|
page_size: int = 100,
|
|
693
719
|
) -> list[Bug]:
|
|
694
|
-
return self._search(Bug, query, include_fields, page_size)
|
|
720
|
+
return self._search(Bug, query, include_fields, exclude_fields, page_size)
|
|
695
721
|
|
|
696
722
|
def search_as(
|
|
697
|
-
self,
|
|
723
|
+
self,
|
|
724
|
+
query: QueryParams,
|
|
725
|
+
bug_type: type[BugType],
|
|
726
|
+
exclude_fields: Optional[list[str]] = None,
|
|
727
|
+
page_size: int = 100,
|
|
698
728
|
) -> list[BugType]:
|
|
699
729
|
include_fields = model_field_names(bug_type)
|
|
700
|
-
return self._search(bug_type, query, include_fields, page_size)
|
|
730
|
+
return self._search(bug_type, query, include_fields, exclude_fields, page_size)
|
|
701
731
|
|
|
702
732
|
def update_bugs(
|
|
703
733
|
self, update_params: BugUpdate, bug_id: Optional[int] = None
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
1
3
|
import pytest
|
|
2
4
|
from pydantic import BaseModel, Field
|
|
3
5
|
|
|
@@ -45,6 +47,23 @@ def test_search_include_comments_and_attachments(bugzilla):
|
|
|
45
47
|
assert bug.id == expected_id
|
|
46
48
|
assert isinstance(bug.comments, list)
|
|
47
49
|
assert isinstance(bug.attachments, list)
|
|
50
|
+
for item in bug.attachments:
|
|
51
|
+
assert "data" not in item
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_search_include_attachments_exclude_data(bugzilla):
|
|
55
|
+
bugs = [423488, 1749533]
|
|
56
|
+
result = bugzilla.search(
|
|
57
|
+
{"id": bugs},
|
|
58
|
+
include_fields=["id", "comments", "attachments"],
|
|
59
|
+
exclude_fields=["attachments.data"],
|
|
60
|
+
)
|
|
61
|
+
for expected_id, bug in zip(bugs, sorted(result, key=lambda x: x.id)):
|
|
62
|
+
assert bug.id == expected_id
|
|
63
|
+
assert isinstance(bug.comments, list)
|
|
64
|
+
assert isinstance(bug.attachments, list)
|
|
65
|
+
for item in bug.attachments:
|
|
66
|
+
assert "data" not in item
|
|
48
67
|
|
|
49
68
|
|
|
50
69
|
def test_bug_as(bugzilla):
|
|
@@ -93,3 +112,15 @@ def test_bug_as_validation_alias(bugzilla):
|
|
|
93
112
|
assert isinstance(result, BugData)
|
|
94
113
|
assert result.id == 975444
|
|
95
114
|
assert result.user_story is not None
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def test_bug_as_exclude(bugzilla):
|
|
118
|
+
class BugData(BaseModel):
|
|
119
|
+
id: int
|
|
120
|
+
attachments: list[dict[str, Any]]
|
|
121
|
+
|
|
122
|
+
result = bugzilla.bug_as(975444, BugData, exclude_fields=["attachments.data"])
|
|
123
|
+
assert isinstance(result, BugData)
|
|
124
|
+
assert result.id == 975444
|
|
125
|
+
assert result.attachments
|
|
126
|
+
assert all("data" not in item for item in result.attachments)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|