예제 #1
0
 def test_convert_date_format_with_invalid_data(self, original_date,
                                                original_format,
                                                required_format):
     """
     Test that in case of any error a relevant error message is displayed
     Args:
         original_date:
         original_format:
         required_format:
     """
     self.assertEqual(
         convert_date_format(original_date, original_format,
                             required_format), 'Invalid date or format')
예제 #2
0
    def coupon_course_start_date(self):
        """
        Get course start date

        Returns:
            str: Start data of course.
        """
        date_string = self.q(css='' + self.course_tile_css +
                             ' .course-start').text[0]
        date_string = extract_mmm_dd_yyyy_date_string_from_text(date_string)
        # Convert date format to 0000-00-00T00:00:00
        return convert_date_format(date_string, '%b %d, %Y',
                                   '%Y-%m-%dT%H:%M:%S')
예제 #3
0
 def test_convert_date_format_with_valid_data(self, original_date,
                                              original_format,
                                              required_format, result):
     """
     Test that dates can be changed from one format to other successfully
     Args:
         original_date:
         original_format:
         required_format:
         result:
     """
     self.assertEqual(
         convert_date_format(original_date, original_format,
                             required_format), result)
예제 #4
0
    def order_date(self):
        """
        Get the order date from receipt

        Returns:
            str: Date of the order
        """
        date_string = self.q(
            xpath=".//*[@id='receipt-container']//dt[text()='Order Date:']"
                  "/following-sibling::dd"
        ).text[0]
        return convert_date_format(
            date_string,
            '%B %d, %Y',
            '%Y-%m-%d'
        )
예제 #5
0
    def order_date(self):
        """
        Get the order date from receipt

        Returns:
            str: Date of the order
        """
        date_string = self.q(
            xpath=".//*[@id='receipt-container']//dt[text()='Order Date:']"
                  "/following-sibling::dd"
        ).text[0]
        return convert_date_format(
            date_string,
            '%B %d, %Y',
            '%Y-%m-%d'
        )
예제 #6
0
    def coupon_course_start_date(self):
        """
        Get course start date

        Returns:
            str: Start data of course.
        """
        date_string = self.q(
            css='' + self.course_tile_css + ' .course-start'
        ).text[0]
        date_string = extract_mmm_dd_yyyy_date_string_from_text(date_string)
        # Convert date format to 0000-00-00T00:00:00
        return convert_date_format(
            date_string,
            '%b %d, %Y',
            '%Y-%m-%dT%H:%M:%S'
        )
예제 #7
0
 def test_convert_date_format_with_invalid_data(
         self,
         original_date,
         original_format,
         required_format
 ):
     """
     Test that in case of any error a relevant error message is displayed
     Args:
         original_date:
         original_format:
         required_format:
     """
     self.assertEqual(
         convert_date_format(
             original_date,
             original_format,
             required_format
         ),
         'Invalid date or format'
     )
예제 #8
0
 def test_convert_date_format_with_valid_data(
         self,
         original_date,
         original_format,
         required_format,
         result
 ):
     """
     Test that dates can be changed from one format to other successfully
     Args:
         original_date:
         original_format:
         required_format:
         result:
     """
     self.assertEqual(
         convert_date_format(
             original_date,
             original_format,
             required_format
         ),
         result
     )