'Test that apps are sorted in order specified in GET params.'

def test_do_sort_webapp(self):

    rf = RequestFactory()
    qs = Webapp.objects.all()
    req = rf.get(self.url, {'sort': 'invalidsort', 'order': 'dontcare'})
    sorted_qs = ReviewersQueuesHelper(req).sort(qs)
    eq_(list(sorted_qs), [self.apps[1], self.apps[0]])
    req = rf.get(self.url, {'sort': 'created', 'order': 'desc'})
    sorted_qs = ReviewersQueuesHelper(req).sort(qs)
    eq_(list(sorted_qs), [self.apps[0], self.apps[1]])
    req = rf.get(self.url, {'sort': 'name', 'order': 'asc'})
    sorted_qs = ReviewersQueuesHelper(req).sort(qs)
    eq_(list(sorted_qs), [self.apps[1], self.apps[0]])
    req = rf.get(self.url, {'sort': 'name', 'order': 'desc'})
    sorted_qs = ReviewersQueuesHelper(req).sort(qs)
    eq_(list(sorted_qs), [self.apps[0], self.apps[1]])
