Exemplo n.º 1
0
    def test_issue_activity(self):
        labels = ['difficulty/newcomer', 'type/bug']
        activity = get_activity('issue', labels)

        # There are two labels 'difficulty/newcomer' and 'type/bug'
        # and the activity_type is issue, so the activity should be
        expected_activity = 'Created a difficulty/newcomer type/bug issue'
        self.assertEquals(activity, expected_activity)
Exemplo n.º 2
0
    def test_mr_activity(self):
        labels = ['difficulty/newcomer', 'type/bug']
        activity = get_activity('merge_request', labels)

        # There are two labels 'difficulty/newcomer' and 'type/bug'
        # and the activity_type is mr, so the activity should be
        expected_activity = 'Solved a difficulty/newcomer type/bug issue'
        self.assertEquals(activity, expected_activity)
Exemplo n.º 3
0
def get_activity_with_points(activity_type, labels):
    """
    Get an activity with points based on the labels
    on the issues or mrs.

    :param activity_type: a string representing the type of the
                          activity. e.g. issue or merge_request.
    :param labels:        a QuerySet dict containing the 'name'
                          as key and 'name of the label' as value.
    :return:              a touple of points and activity string.
    """
    labels = get_sorted_labels(labels)
    points = get_total_points(activity_type, labels)
    activity = get_activity(activity_type, labels)
    return points, activity
Exemplo n.º 4
0
 def test_undefined_activity(self):
     labels = ['difficulty/newcomer', 'type/bug']
     with self.assertRaises(ValueError):
         get_activity('undefined', labels)