Exemplo n.º 1
0
    def test_related_fields(self):
        """Tests that related fields not defined on the model are included."""
        pepulator = Distributor.objects.get(name="Mom & Pop")

        expected_detail = (
            u"Mom & Pop:distributor," "name,name,Mom & Pop," "capacity,capacity,175," "stock,stock,[Pepulator #1238,],"
        )
        detail = model_filters.as_detail_html(pepulator)

        model_nodes.get_template.assert_called_with("model_filters/object_detail.html")
        self.assertEqual(detail, expected_detail)
Exemplo n.º 2
0
    def test_model_format(self):
        """Tests that a given model is formatted as expected."""
        pepulator = Pepulator.objects.get(serial_number=1235)

        expected_detail = (
            u"Pepulator #1235:pepulator,"
            "serial_number,serial number,1235,"
            "height,height,12,"
            "width,width,15,"
            "manufacture_date,manufacture date,2011-06-10 11:12:33,"
            "color,color,red,"
            "distributed_by,distributed by,Walmart,"
            "knuckles,knuckles,[Knuckle of hardness 2.35,Knuckle of hardness 1.10,],"
            "jambs,jambs,[],"
        )
        detail = model_filters.as_detail_html(pepulator)

        model_nodes.get_template.assert_called_with("model_filters/object_detail.html")
        self.assertEqual(detail, expected_detail)