Example #1
0
 def test_get_fields(self):
     """Test displayed fields"""
     site = AdminSite()
     fadm = admin.FamilyInvitationInline(Event, site)
     expected_fields = [
         'event',
         'family',
         'send_mail',
         'show_mail',
     ]
     self.assertEqual(list(fadm.get_fields(MockRequest.instance())),
                      expected_fields)
     self.assertEqual(
         list(fadm.get_fields(MockRequest.instance(), self.event)),
         expected_fields)
Example #2
0
 def test_get_fields(self):
     """Test displayed fields"""
     fadm = admin.EventAdmin(Event, self.site)
     expected_fields = [
         'name',
         'date',
     ]
     self.assertListEqual(
         list(fadm.get_form(MockRequest.instance()).base_fields),
         expected_fields)
     self.assertEqual(list(fadm.get_fields(MockRequest.instance())),
                      expected_fields)
     self.assertEqual(
         list(fadm.get_fields(MockRequest.instance(), self.event)),
         expected_fields)
Example #3
0
 def test_inlines(self):
     """Test inlines"""
     fadm = admin.EventAdmin(Event, self.site)
     inline_instances = fadm.get_inline_instances(MockRequest.instance())
     self.assertListEqual(list(map(type, inline_instances)), [
         admin.MailTemplateInline,
         admin.FamilyInvitationInline,
     ])
Example #4
0
 def test_get_fields(self):
     """Test get_fields method"""
     fadm = admin.FamilyAdmin(Family, self.site)
     expected_fields = [
         'invited_midday',
         'invited_afternoon',
         'invited_evening',
         'host',
     ]
     self.assertListEqual(
         list(fadm.get_form(MockRequest.instance()).base_fields),
         expected_fields)
     self.assertEqual(list(fadm.get_fields(MockRequest.instance())),
                      expected_fields)
     self.assertEqual(
         list(fadm.get_fields(MockRequest.instance(), self.family)),
         expected_fields)
Example #5
0
    def test_show_mail_html(self):
        """test with success"""
        result = show_mail_html(MockRequest.instance(), self.event.pk, self.family.pk)

        self.assertHTMLEqual(result.content.decode("utf-8"), self.expected_html)
Example #6
0
 def test_get_list_display(self):
     """Test displayed fields"""
     fadm = admin.EventAdmin(Event, self.site)
     self.assertListEqual(
         list(fadm.get_list_display(MockRequest.instance())), ["__str__"])
Example #7
0
 def test_get_list_display(self):
     """Test get_list_display method"""
     fadm = admin.FamilyAdmin(Family, self.site)
     self.assertListEqual(
         list(fadm.get_list_display(MockRequest.instance())), ["__str__"])