Exemplo n.º 1
0
    def test_item_create_calls_item_created_event(self, mock_create_event):
        sprint = Sprint.objects.create(
            name='256',
            start_date=self.today,
            end_date=self.tomorrow
        )

        item = Item(
            name='Int.32',
            description='test item',
            estimate_work=3,
            estimate_review=2,
            sprint=sprint
        )

        expected_event = Event(
            sprint=sprint,
            change=Event.INC,
            value=5
        )

        mock_create_event.return_value = expected_event

        item.save()

        events = Event.get_events(sprint)
        assert len(events) == 1

        event = events[0]
        assert event.sprint == expected_event.sprint
        assert event.change == expected_event.change
        assert event.value == expected_event.value
Exemplo n.º 2
0
    def test_if_event_can_be_created(self):
        event = Event.objects.create(
            sprint=self.sprint,
            change=Event.INC,
            value=3
        )

        assert event in Event.get_events(self.sprint)
Exemplo n.º 3
0
    def test_events_can_be_fetched_ordered_by_date(self):
        more_changes = [("2015-05-01", 3), ("2015-05-02", 5), ("2015-05-09", -8)]

        events = self.create_events(self.sprint, self.changes + more_changes)

        assert len(events) == len(Event.get_events(self.sprint))

        timetable = Event.get_events_timetable(self.sprint)
        assert 2 == len(timetable["2015-05-01"])
        assert -2 == sum(timetable["2015-05-01"])
Exemplo n.º 4
0
 def test_events_can_be_fetched_by_sprint(self):
     events = self.create_events(self.sprint, self.changes)
     assert len(events) == len(Event.get_events(self.sprint))