• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / relman-auto-nag / #5297

28 Oct 2024 05:39PM CUT coverage: 21.555% (+0.003%) from 21.552%
#5297

push

coveralls-python

benjaminmah
Added start date for BZ params

426 of 2880 branches covered (14.79%)

0 of 1 new or added line in 1 file covered. (0.0%)

1941 of 9005 relevant lines covered (21.55%)

0.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/bugbot/rules/pending_sec_no_tracking.py
1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
# You can obtain one at http://mozilla.org/MPL/2.0/.
4

5
from libmozdata.bugzilla import Bugzilla
×
6

7
from bugbot import utils
×
8
from bugbot.bzcleaner import BzCleaner
×
9

10

11
class SecurityApprovalTracking(BzCleaner):
×
12
    def __init__(self, channel):
×
13
        super().__init__()
×
14
        self.channel = channel
×
15
        if not self.init_versions():
×
16
            return
×
17

18
        self.version = self.versions[channel] if self.versions else None
×
19

20
        self.extra_ni = None
×
21

22
    def description(self):
×
23
        return "Bugs with attachments pending security approval and incomplete tracking flags"
×
24

25
    def handle_bug(self, bug, data):
×
26
        # Assuming these bugs are bugs that do not have a status flag set to either "affected" or "unaffected"
27
        bugid = str(bug["id"])
×
28
        data[bugid] = {
×
29
            "id": bugid,
30
            "summary": bug["summary"],
31
            "assignee": bug["assigned_to"],
32
        }
33
        self.add_auto_ni(
×
34
            bugid,
35
            {"mail": bug["assigned_to"], "nickname": bug["assigned_to_detail"]["nick"]},
36
        )
37

38
        return bug
×
39

40
    def get_bugs(self, date="today", bug_ids=[], chunk_size=None):
×
41
        bugs = super().get_bugs(date, bug_ids, chunk_size)
×
42

43
        Bugzilla(
×
44
            bugs.keys(),
45
            include_fields=self.fields,
46
            bughandler=self.handle_bug,
47
            bugdata=bugs,
48
        ).wait()
49

50
        self.extra_ni = bugs
×
51
        return bugs
×
52

53
    def get_extra_for_needinfo_template(self):
×
54
        return self.extra_ni
×
55

56
    def columns(self):
×
57
        return ["id", "summary", "assignee"]
×
58

59
    def get_bz_params(self, date):
×
NEW
60
        start_date, _ = self.get_dates(date)
×
61

62
        self.status = utils.get_flag(self.version, "status", self.channel)
×
63
        self.tracking = utils.get_flag(self.version, "tracking", self.channel)
×
64
        self.fields = [
×
65
            "id",
66
            "assigned_to",
67
            "nickname",
68
            "flags",
69
            self.tracking,
70
            self.status,
71
        ]
72

73
        params = {
×
74
            "include_fields": self.fields,
75
            "resolution": "---",
76
            "f1": "creation_ts",
77
            "o1": "greaterthan",
78
            "v1": start_date,
79
            "f2": self.status,
80
            "o2": "anywords",
81
            "n2": "1",
82
            "v2": ",".join(["unaffected", "affected"]),
83
            "f3": "flagtypes.name",
84
            "o3": "substring",
85
            "v3": "sec-approval?",
86
        }
87

88
        return params
×
89

90

91
if __name__ == "__main__":
×
92
    SecurityApprovalTracking("beta").run()
×
93
    SecurityApprovalTracking("central").run()
×
94
    SecurityApprovalTracking("esr").run()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc