예제 #1
0
    def test_api_section_serializer_format_time_handles_minutes(self):
        """ Tests that the section serializer's format_time(time) function formats
            minutes correctly
        """
        # Arrange
        test_time = time(9, 10)
        expected = '09:10'

        # Act
        result = format_time(test_time)

        # Assert
        self.assertEqual(expected, result)
예제 #2
0
    def test_api_section_serializer_format_time_handles_hour(self):
        """ Tests that the section serializer's format_time(time) function handles
            a time with 0 minutes
        """
        # Arrange
        test_time = time(10)
        expected = '10:00'

        # Act
        result = format_time(test_time)

        # Assert
        self.assertEqual(expected, result)
예제 #3
0
    def test_api_section_serializer_format_time_handles_leading_zero(self):
        """ Tests that the section serializer's format_time(time) function pads zeroes
            to a time with hour < 10 (ex. time(9) -> '09:00'
        """
        # Arrange
        test_time = time(9)
        expected = '09:00'

        # Act
        result = format_time(test_time)

        # Assert
        self.assertEqual(expected, result)
예제 #4
0
    def test_api_section_serializer_format_time_handles_null(self):
        """ Tests that the section serializer's format_time(time) function handles
            a None time
        """
        # Arrange
        test_time = None
        expected = ''

        # Act
        result = format_time(test_time)

        # Assert
        self.assertEqual(expected, result)