def test_during(self):
        c = Criteria(Project.OAS)
        c.add(
            Restrictions.change_status_during(
                [Status.STORY_PROGRESS, Status.STORY_SELECTED],
                Status.HIST_ANALISIS_FUN, '2020/01/01', '2020/02/02'))

        self.assertEqual(
            'project = "OAS" and status changed FROM ("Story in progress", "Story Selected") TO '
            '"HISTORIA EN ANALISIS FUNCIONAL" DURING ("2020/01/01", "2020/02/02")',
            c.query_build())
    def test_restriction_in_enum(self):
        c = Criteria(Project.OAS)
        c.add(Restrictions.in_enum(Labels.LT_OK))

        self.assertEqual('project = "OAS" and Labels in ("LT_OK")',
                         c.query_build())

        c = Criteria(Project.OAS)
        c.add(Restrictions.in_enum(Labels.LT_OK, Labels.SP))

        self.assertEqual('project = "OAS" and Labels in ("LT_OK","SP")',
                         c.query_build())
Beispiel #3
0
 def search(self, criteria: Criteria):
     res = requests.post(JIRA_ENDPOINT + JIRA_SEARCH_LIST,
                         data=criteria.query_json(),
                         headers={"Content-Type": "application/json"},
                         auth=HTTPBasicAuth(USER, PASS_WORD))
     resJson = json.loads(res.content.decode("utf8"))
     print(resJson)
     return resJson
    def test_restrictions(self):
        c = Criteria(Project.OAS)
        c.add(Restrictions.eq(Field.ASSIGNEE, "value"))
        c.add(Restrictions.eq(Field.KEY, "value"))

        self.assertEqual(
            'project = "OAS" and assignee = "value" and key = "value"',
            c.query_build())
    def test_json(self):
        c = Criteria(Project.OAS)
        c.page_limit(10)
        c.page_start_at(5)

        self.assertEqual(
            '{"jql": "project = \\"OAS\\"", "startAt": 5, "maxResults": 10}',
            c.query_json().__str__())
    def test_criteria_project(self):
        c1p = Criteria(Project.OAS)
        c_more_pro = Criteria(Project.OAS, Project.WOLFF)

        self.assertEqual(c1p.query_build(), 'project = "OAS"')
        self.assertEqual(c_more_pro.query_build(),
                         'project in ("OAS","WOLFF")')
    def test_order(self):
        c = Criteria(Project.OAS)
        c.add_order(Field.ASSIGNEE, Field.KEY)

        self.assertEqual('project = "OAS" ORDER BY "assignee", "key"',
                         c.query_build())
    def test_is_null(self):
        c = Criteria(Project.OAS)
        c.add(Restrictions.is_null(Field.ASSIGNEE))

        self.assertEqual('project = "OAS" and assignee is null',
                         c.query_build())
    def test_restriction_eq_enum(self):
        c = Criteria(Project.OAS)
        c.add(Restrictions.eq_enum(Labels.LT_OK))

        self.assertEqual('project = "OAS" and Labels = "LT_OK"',
                         c.query_build())
    def test_criteria_add_sql(self):
        c = Criteria(Project.OAS)
        c.add('field = "value"')

        self.assertEqual('project = "OAS" and field = "value"',
                         c.query_build())
Beispiel #11
0
    User.FRAN.description, User.GUIDO.description, User.JAVI.description,
    User.JOACO.description, User.JULI.description
]

storySprintSelected = Restrictions.add_and(
    Restrictions.eq_enum(Labels.SP),
    Restrictions.in_enum(Status.BACKLOG, Status.STORY_SELECTED,
                         Status.STORY_PROGRESS))
storyInProgress = Restrictions.in_enum(Status.STORY_PROGRESS)
storyByWork = Restrictions.add_or(storySprintSelected, storyInProgress)
storyWorkByMyTeam = Restrictions.in_field(Field.ASSIGNEE, *ALL_DEV_TEAM)

# historias para tomar esta semana, tageadas con el label de SP o en progreso
c = Criteria(*ALL_PROJECTS_MY_TEAM)\
    .add(storyByWork)\
    .add(storyWorkByMyTeam)\
    .add_order(Field.ASSIGNEE, Field.PRIORITY, Field.PROJECT, Field.KEY)\
    .add_response_fields(Field.KEY, Field.ASSIGNEE, Field.ITEMS, Field.STATUS, Field.PRIORITY, Field.ISSUETYPE, Field.REPORTER, Field.SUMMARY)

# print(c.query_json())

reportJson = JiraConnector().search(c)
jirasByDevs = {}
for issue in reportJson["issues"]:
    row = JiraData(issue)
    if row.user not in jirasByDevs.keys():
        jirasByDevs[row.user] = list()
    jirasByDevs[row.user].append(row)

html = HtmlFile()
now = datetime.now()
Beispiel #12
0
storySprintSelected = Restrictions.add_and(Restrictions.eq_enum(Labels.SP), Restrictions.in_enum(Status.BACKLOG, Status.STORY_SELECTED, Status.STORY_PROGRESS))
storyInProgress = Restrictions.in_enum(Status.STORY_PROGRESS)
storyByWork = Restrictions.add_or(storySprintSelected, storyInProgress)
storyWorkByMyTeam = Restrictions.in_field(Field.ASSIGNEE, *ALL_DEV_TEAM)

today = datetime.date.today()
last_monday = today - datetime.timedelta(days=today.weekday())
coming_friday = last_monday + datetime.timedelta(days=4)
toDate = last_monday.strftime("%Y/%m/%d")
fromDate = coming_friday.strftime("%Y/%m/%d")

# que hicimos de lo que estaba en el sprint
criteria_do_worked_sprint = Criteria(*ALL_PROJECTS_MY_TEAM)\
    .add(Restrictions.eq_enum(Labels.SP))\
    .add(Restrictions.change_to_status_during(Status.STORY_WAITING_REVIEW, toDate, fromDate))\
    .add(storyWorkByMyTeam)\
    .add_order(Field.ASSIGNEE, Field.PRIORITY, Field.PROJECT, Field.KEY)\
    .add_response_fields(Field.KEY, Field.ASSIGNEE, Field.ITEMS, Field.STATUS, Field.PRIORITY, Field.ISSUETYPE, Field.REPORTER, Field.SUMMARY)

# que no llegamo a terminar
criteria_not_worked_sprint = Criteria(*ALL_PROJECTS_MY_TEAM)\
    .add(Restrictions.eq_enum(Labels.SP))\
    .add(Restrictions.in_enum(Status.BACKLOG, Status.STORY_SELECTED, Status.STORY_PROGRESS))\
    .add(storyWorkByMyTeam)\
    .add_order(Field.ASSIGNEE, Field.PRIORITY, Field.PROJECT, Field.KEY)\
    .add_response_fields(Field.KEY, Field.ASSIGNEE, Field.ITEMS, Field.STATUS, Field.PRIORITY, Field.ISSUETYPE, Field.REPORTER, Field.SUMMARY)


# que tomamos por fuera
criteria_do_worked_out_sprint = Criteria(*ALL_PROJECTS_MY_TEAM)\
    .add(Restrictions.add_or(Restrictions.not_eq_enum(Labels.SP), Restrictions.is_null(Field.LABELS)))\