lundi 3 juillet 2017

Django nose test coverage doesnt recognize admin.py files

I am using django nose for test coverage and I cannot get the test cover admin.py files.

authentication/admin.py 16 16 0%

I dont know how to cover the admin.py files or if they should be covered.

This what I a trying right now:

class ModelAdminTests(TestCase):

    def setUp(self):
        self.user = User.objects.create(
            email="test@testing.com")

    def test_modeladmin_str(self):
        ua = UserAdmin(User, self.user)
        self.assertEqual(str(ua), 'authentication.UserAdmin')

    def test_default_fields(self):
        ua = UserAdmin(User, self.user)
        self.assertEqual(list(ua.list_display), ['email', 'position', 'trend'])

Aucun commentaire:

Enregistrer un commentaire