示例#1
0
    def test_no_trip_type(self):
        """For trips without a trip_type, we use program."""
        circus_trip = factories.TripFactory.build(
            trip_type=enums.TripType.NONE.value,
            program=enums.Program.CIRCUS.value)
        self.assertEqual(
            icons.for_trip(circus_trip),
            '<i class="fa fa-fw fa-users" title="Circus"></i>',
        )

        cabin_trip = factories.TripFactory.build(
            trip_type=enums.TripType.OTHER.value,
            program=enums.Program.CABIN.value)
        self.assertEqual(icons.for_trip(cabin_trip),
                         '<i class="fa fa-fw fa-home" title="Cabin"></i>')
示例#2
0
 def test_trip_type(self):
     skating_trip = factories.TripFactory.build(
         trip_type=enums.TripType.ICE_SKATING.value,
         program=enums.Program.WINTER_SCHOOL.value,
     )
     self.assertEqual(
         icons.for_trip(skating_trip),
         '<i class="fa fa-fw fa-skating" title="Ice skating"></i>',
     )
示例#3
0
 def test_regular_icon(self):
     """Some icons will use FontAwesome 'regular' over solid."""
     climbing_trip = factories.TripFactory.build(
         trip_type=enums.TripType.GYM_CLIMBING.value,
         program=enums.Program.CLIMBING.value,
     )
     self.assertEqual(
         icons.for_trip(climbing_trip),
         '<i class="far fa-fw fa-hand-rock" title="Gym climbing"></i>',
     )
示例#4
0
def trip_icon(trip):
    return icons.for_trip(trip)
示例#5
0
 def test_no_icon(self):
     """Without sufficient information, no icon can be rendered."""
     misc_trip = factories.TripFactory.build(
         trip_type=enums.TripType.OTHER.value,
         program=enums.Program.NONE.value)
     self.assertEqual(icons.for_trip(misc_trip), '')