Esempio n. 1
0
class TestItems(SprintlyTestCase):
    def setUp(self):
        self._items = Items('user', 'key', 'product')

    def test_get_items_raises_on_wrong_type(self):
        item_type = 'random'
        with self.assertRaises(SprintlyError):
            self._items.get_items(item_type=item_type)

    def test_get_items_raises_on_wrong_status(self):
        item_status = 'random'
        with self.assertRaises(SprintlyError):
            self._items.get_items(item_type='task', item_status=item_status)

    def test_get_items_sends_assigned_to_when_valid(self):
        return_value = MockSprintlyResponse(status_code=200,
                                            reason='OK',
                                            json={})
        sut = self._mock_session_for(self._items, 'get', return_value)
        self._items.get_items(item_type='task',
                              item_status='in-progress',
                              assigned_to=11)
        expected = {'type': 'task', 'status': 'in-progress', 'assigned_to': 11}
        actual = sut.call_args_list[0][1]['params']
        self.assertDictEqual(expected, actual)
Esempio n. 2
0
class TestItems(SprintlyTestCase):
    def setUp(self):
        self._items = Items('user', 'key', 'product')

    def test_get_items_raises_on_wrong_type(self):
        item_type = 'random'
        with self.assertRaises(SprintlyError):
            self._items.get_items(item_type=item_type)

    def test_get_items_raises_on_wrong_status(self):
        item_status = 'random'
        with self.assertRaises(SprintlyError):
            self._items.get_items(item_type='task',
                    item_status=item_status)

    def test_get_items_sends_assigned_to_when_valid(self):
        return_value = MockSprintlyResponse(
                status_code=200,
                reason='OK',
                json={})
        sut = self._mock_session_for(self._items, 'get', return_value)
        self._items.get_items(
                item_type='task',
                item_status='in-progress',
                assigned_to=11)
        expected = {
                'type': 'task',
                'status': 'in-progress',
                'assigned_to': 11}
        actual = sut.call_args_list[0][1]['params']
        self.assertDictEqual(expected, actual)
Esempio n. 3
0
    def _handle_items_request(self, args):
        user = args['--user']
        key = args['--key']
        product = args['--product']

        items = Items(user, key, product)

        if args['show']:
            assigned_to = args['--user_id']

            # Item type defaults to tasks
            item_type = args['--type']
            if item_type is None:
                item_type = 'story'

            # Item status defaults to in-progress
            item_status = args['--status']
            if item_status is None:
                item_status = 'in-progress'

            return items.get_items(
                    item_type=item_type,
                    item_status=item_status,
                    assigned_to=assigned_to)
Esempio n. 4
0
 def setUp(self):
     self._items = Items('user', 'key', 'product')
Esempio n. 5
0
 def setUp(self):
     self._items = Items('user', 'key', 'product')