Hi, 

I would like to unit-test the activate_apps( ) and deactivate_apps( ) 
functions below, as low-level as possible.

How could I do this without going through Selenium (FT) route?

In my admin.py:

from django.contrib import admin
from my_app_listing.models import App

class AppAdmin(admin.ModelAdmin):
    actions = ['activate_apps', 'deactivate_apps']
    list_display = ('name', 'is_active', 'frequency')
    fieldsets = [
        (None, {'fields': ['name']}),
        (None, {'fields': ['is_active']}),
        (None, {'fields': ['frequency']}),
        ('Description', {'fields': ['description'], 'classes': ['collapse'
]}),
    ]

    def activate_apps(self, request, queryset):
        queryset.update(is_active=True)
    activate_apps.short_description = "Activate selected Apps"

    def deactivate_apps(self, request, queryset):
        queryset.update(is_active=False)
    deactivate_apps.short_description = "Deactivate selected Apps"

admin.site.register(App, AppAdmin)

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bea4fcab-8d7c-4613-9454-f5a70181ce5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to