Esempio n. 1
0
    def run(self, args):
        # parse and verify user arguments
        users = InputHelper.sanitize_users(args.user)
        dates = InputHelper.sanitize_dates(args.date)
        InputHelper.ensure_max_2_dates(dates)

        # print output to console
        self._output(self._get_projects(dates, users), users)
Esempio n. 2
0
 def testSanitizeInputUsers(self):
     """should return None if an empty list is given"""
     self.assertIsNone(InputHelper.sanitize_users([]))
     self.assertListEqual([111], InputHelper.sanitize_users([111]),
                          'should return the same users')
     self.assertListEqual([111, 112], InputHelper.sanitize_users([111,
                                                                  112]),
                          'should return the same users')
Esempio n. 3
0
    def run(self, args):
        # parse and verify user arguments
        users = InputHelper.sanitize_users(args.user)
        dates = InputHelper.sanitize_dates(args.date)
        InputHelper.ensure_max_2_dates(dates)

        # print output to console
        self._output(self._get_projects(dates, users), users)
Esempio n. 4
0
 def testSanitizeInputDates(self):
     """should always return a list"""
     san = InputHelper.sanitize_dates(None)
     self.assertListEqual(
         [], san, 'should return an empty list if no dates are specified')
     san = InputHelper.sanitize_dates(['2013.05.22'])
     self.assertListEqual(
         ['2013.05.22'], san,
         'should return the same list if dates are specified')
Esempio n. 5
0
    def run(self, args):
        name = InputHelper.get_user_input(
            'Give me a nickname for your sprint (no special chars): ', str)

        sprint = dict()
        sprint['commited_man_days'] = InputHelper.get_user_input(
            'Give me the number of commited man days for this sprint: ', float)

        # add zebra/jira data
        sprint['zebra'] = self._get_zebra_data()
        sprint['jira'] = self._get_jira_data()

        # write to config file
        AppContainer.config.create_sprint(name, sprint)
Esempio n. 6
0
 def testGetUserInput(self):
     """test getting and formating user input"""
     self.assertEquals(
         'string',
         InputHelper.get_user_input('input a string', str,
                                    lambda _: 'string'))
     self.assertEquals(
         10, InputHelper.get_user_input('input an int', int, lambda _: 10))
     self.assertEquals(
         10.00,
         InputHelper.get_user_input('input a float', float,
                                    lambda _: 10.00))
     self.assertEquals(
         10.00,
         InputHelper.get_user_input('input a float', float, lambda _: '10'))
     date = datetime.date(2013, 05, 27)
     self.assertEquals(
         date,
         InputHelper.get_user_input('input a date', 'date',
                                    lambda _: '2013-05-27'))
     self.assertEquals(
         date,
         InputHelper.get_user_input('input a date', 'date',
                                    lambda _: '27.05.2013'))
     self.assertEquals(
         date,
         InputHelper.get_user_input('input a date', 'date',
                                    lambda _: '05.27.2013'))
     self.assertRaises(InputParametersError, InputHelper.get_user_input,
                       'not an int', int, lambda _: 'not an int')
     self.assertRaises(InputParametersError, InputHelper.get_user_input,
                       'not a float', float, lambda _: 'not a float')
Esempio n. 7
0
    def _get_zebra_data(self):
        start_date = InputHelper.get_user_input('Give me the sprint start date (as 2013.02.25): ', 'date')
        end_date = InputHelper.get_user_input('Give me the sprint end date (as 2013.02.25): ', 'date')

        client_id = InputHelper.get_user_input(
            'Give me the zebra project id (if you use Taxi, just do `taxi search client_name` else check in Zebra. '
            'It should be a four digit integer): ',
            int
        )

        zebra_data = dict()
        zebra_data['activities'] = '*'
        zebra_data['users'] = '*'
        zebra_data['start_date'] = start_date
        zebra_data['end_date'] = end_date
        zebra_data['client_id'] = client_id

        return zebra_data
Esempio n. 8
0
    def run(self, args):
        name = InputHelper.get_user_input(
            'Give me a nickname for your sprint (no special chars): ',
            str
        )

        sprint = dict()
        sprint['commited_man_days'] = InputHelper.get_user_input(
            'Give me the number of commited man days for this sprint: ',
            float
        )

        # add zebra/jira data
        sprint['zebra'] = self._get_zebra_data()
        sprint['jira'] = self._get_jira_data()

        # write to config file
        AppContainer.config.create_sprint(name, sprint)
Esempio n. 9
0
    def _get_zebra_data(self):
        start_date = InputHelper.get_user_input(
            'Give me the sprint start date (as 2013.02.25): ', 'date')
        end_date = InputHelper.get_user_input(
            'Give me the sprint end date (as 2013.02.25): ', 'date')

        client_id = InputHelper.get_user_input(
            'Give me the zebra project id (if you use Taxi, just do `taxi search client_name` else check in Zebra. '
            'It should be a four digit integer): ', int)

        zebra_data = dict()
        zebra_data['activities'] = '*'
        zebra_data['users'] = '*'
        zebra_data['start_date'] = start_date
        zebra_data['end_date'] = end_date
        zebra_data['client_id'] = client_id

        return zebra_data
Esempio n. 10
0
    def _get_jira_data(self):
        story = InputHelper.get_user_input(
            'Give me the jira id of any story in your sprint (something like \'jlc-110\'): ',
            str
        ).upper()
        story_data = self.get_jira_manager().get_story(story)

        jira_data = {}
        jira_data['project_id'] = int(story_data.project_id)
        jira_data['sprint_name'] = JiraHelper.sanitize_sprint_name(story_data.sprint_name)

        return jira_data
Esempio n. 11
0
    def _get_jira_data(self):
        story = InputHelper.get_user_input(
            'Give me the jira id of any story in your sprint (something like \'jlc-110\'): ',
            str).upper()
        story_data = self.get_jira_manager().get_story(story)

        jira_data = {}
        jira_data['project_id'] = int(story_data.project_id)
        jira_data['sprint_name'] = JiraHelper.sanitize_sprint_name(
            story_data.sprint_name)

        return jira_data
Esempio n. 12
0
 def testGetUserInput(self):
     """test getting and formating user input"""
     self.assertEquals('string', InputHelper.get_user_input('input a string', str, lambda _:'string'))
     self.assertEquals(10, InputHelper.get_user_input('input an int', int, lambda _:10))
     self.assertEquals(10.00, InputHelper.get_user_input('input a float', float, lambda _:10.00))
     self.assertEquals(10.00, InputHelper.get_user_input('input a float', float, lambda _:'10'))
     date = datetime.date(2013, 05, 27)
     self.assertEquals(date, InputHelper.get_user_input('input a date', 'date', lambda _:'2013-05-27'))
     self.assertEquals(date, InputHelper.get_user_input('input a date', 'date', lambda _:'27.05.2013'))
     self.assertEquals(date, InputHelper.get_user_input('input a date', 'date', lambda _:'05.27.2013'))
     self.assertRaises(InputParametersError, InputHelper.get_user_input, 'not an int', int, lambda _:'not an int')
     self.assertRaises(
         InputParametersError, InputHelper.get_user_input, 'not a float', float, lambda _:'not a float'
     )
Esempio n. 13
0
 def testMax2DatesWith1Date(self):
     """should not raise any error"""
     dates = ['2013.05.22']
     InputHelper.ensure_max_2_dates(dates)
Esempio n. 14
0
 def testMax2DatesWith1Date(self):
     """should not raise any error"""
     dates = ['2013.05.22']
     InputHelper.ensure_max_2_dates(dates)
Esempio n. 15
0
 def testSanitizeInputUsers(self):
     """should return None if an empty list is given"""
     self.assertIsNone(InputHelper.sanitize_users([]))
     self.assertListEqual([111], InputHelper.sanitize_users([111]), 'should return the same users')
     self.assertListEqual([111, 112], InputHelper.sanitize_users([111, 112]), 'should return the same users')
Esempio n. 16
0
 def testSanitizeInputDates(self):
     """should always return a list"""
     san = InputHelper.sanitize_dates(None)
     self.assertListEqual([], san, 'should return an empty list if no dates are specified')
     san = InputHelper.sanitize_dates(['2013.05.22'])
     self.assertListEqual(['2013.05.22'], san, 'should return the same list if dates are specified')