def testGetFormattedDateTimeComponents(self):
        zhArrowDateTimeObjRef = DateTimeUtil.dateTimeStringToArrowLocalDate("2017/09/30 02:00:00", 'Europe/Zurich',
                                                                            "YYYY/MM/DD HH:mm:ss")

        dateTimeComponentSymbolList, separatorsList, dateTimeComponentValueList = DateTimeUtil.getFormattedDateTimeComponents(zhArrowDateTimeObjRef, 'DD/MM/YY HH:mm')

        self.assertEqual(['DD', 'MM', 'YY', 'HH', 'mm'], dateTimeComponentSymbolList)
        self.assertEqual(['/', ':'], separatorsList)
        self.assertEqual(['30', '09', '17', '02', '00'], dateTimeComponentValueList)

        dateTimeComponentSymbolList, separatorsList, dateTimeComponentValueList = DateTimeUtil.getFormattedDateTimeComponents(zhArrowDateTimeObjRef, 'YYYY.MM.DD HH.mm')

        self.assertEqual(['YYYY', 'MM', 'DD', 'HH', 'mm'], dateTimeComponentSymbolList)
        self.assertEqual(['\.', '\.'], separatorsList)
        self.assertEqual(['2017', '09', '30', '02', '00'], dateTimeComponentValueList)

        dateTimeComponentSymbolList, separatorsList, dateTimeComponentValueList = DateTimeUtil.getFormattedDateTimeComponents(zhArrowDateTimeObjRef, 'YYYY.MM.DD HH-mm')

        self.assertEqual(['YYYY', 'MM', 'DD', 'HH', 'mm'], dateTimeComponentSymbolList)
        self.assertEqual(['\.', '-'], separatorsList)
        self.assertEqual(['2017', '09', '30', '02', '00'], dateTimeComponentValueList)

        dateTimeComponentSymbolList, separatorsList, dateTimeComponentValueList = DateTimeUtil.getFormattedDateTimeComponents(zhArrowDateTimeObjRef, 'MM-DD-YYYY HH.mm')

        self.assertEqual(['MM', 'DD', 'YYYY', 'HH', 'mm'], dateTimeComponentSymbolList)
        self.assertEqual(['-', '\.'], separatorsList)
        self.assertEqual(['09', '30', '2017', '02', '00'], dateTimeComponentValueList)
    def _buildFullDateAndTimeStrings(self, commandDic, timezoneStr):
        '''
        This method ensures that the full command string is unified whatever the completness of the
        dated/time components specified in the request by the user.

        Ex: btc usd 1/1 bitfinex or btc usd 1/01/18 bitfinex or btc usd 1/1 12:23 bitfinex all return
            a full commaand of btc usd 01/01/18 00:00 bitfinex, btc usd 01/01/18 12:23 bitfinex
            respectively.

        This is important since the ful command string is what is stored in the command history list, with
        no duplicates. Otherwxise, btc usd 1/1 00:00 bitfinex and btc usd 01/01/18 00:00 bitfinex would
        be stored as 2 entries !

        :param commandDic:
        :param timezoneStr:
        :seqdiag_return requestDateDMY, requestDateHM
        :return:
        '''
        dayInt = int(commandDic[CommandPrice.DAY])
        monthInt = int(commandDic[CommandPrice.MONTH])
        year = commandDic[CommandPrice.YEAR]

        if year == None:
            now = DateTimeUtil.localNow(timezoneStr)
            yearInt = now.year
        else:
            yearInt = int(year)

        hour = commandDic[CommandPrice.HOUR]
        minute = commandDic[CommandPrice.MINUTE]

        if hour != None and minute != None:
            # hour can not exist without minute and vice versa !
            hourInt = int(hour)
            minuteInt = int(minute)
        else:
            hourInt = 0
            minuteInt = 0

        requestArrowDate = DateTimeUtil.dateTimeComponentsToArrowLocalDate(
            dayInt, monthInt, yearInt, hourInt, minuteInt, 0, timezoneStr)
        dateTimeComponentSymbolList, separatorsList, dateTimeComponentValueList = DateTimeUtil.getFormattedDateTimeComponents(
            requestArrowDate, self.configurationMgr.dateTimeFormat)
        dateSeparator = separatorsList[0]
        timeSeparator = separatorsList[1]
        requestDateDMY = dateTimeComponentValueList[0] + dateSeparator + dateTimeComponentValueList[1] + dateSeparator + \
                         dateTimeComponentValueList[2]
        requestDateHM = dateTimeComponentValueList[
            3] + timeSeparator + dateTimeComponentValueList[4]

        from seqdiagbuilder import SeqDiagBuilder
        SeqDiagBuilder.recordFlow()

        return requestDateDMY, requestDateHM