# Path: tests/cases/resources/tests/base.py
# class AuthenticatedBaseTestCase(BaseTestCase):
#     def setUp(self):
#         super(AuthenticatedBaseTestCase, self).setUp()
# 
#         self.user = User.objects.create_user(username='test', password='test')
#         self.client.login(username='test', password='test')


import json
from restlib2.http import codes
from avocado.models import DataContext
from .base import AuthenticatedBaseTestCase
        cxt.save()

        response = self.client.get('/api/contexts/{0}/stats/'.format(cxt.pk),
                                   HTTP_ACCEPT='application/json')

        self.assertEqual(json.loads(response.content)['count'], 6)

    def test_session(self):
        cxt = DataContext(session=True, user=self.user)
        cxt.save()

        response = self.client.get('/api/contexts/session/stats/',
                                   HTTP_ACCEPT='application/json')

        self.assertEqual(json.loads(response.content)['count'], 6)

    def test_processor(self):
        cxt = DataContext(session=True, user=self.user)
        cxt.save()

        response = self.client.get('/api/contexts/{0}/stats/'.format(cxt.pk),
                                   HTTP_ACCEPT='application/json')
        self.assertEqual(json.loads(response.content)['count'], 6)

        response = self.client.get('/api/contexts/{0}/stats/?processor=manager'
                                   .format(cxt.pk),
                                   HTTP_ACCEPT='application/json')
        self.assertEqual(json.loads(response.content)['count'], 1)



# Path: tests/cases/resources/tests/base.py
# class AuthenticatedBaseTestCase(BaseTestCase):
#     def setUp(self):
#         super(AuthenticatedBaseTestCase, self).setUp()
# 
#         self.user = User.objects.create_user(username='test', password='test')
#         self.client.login(username='test', password='test')


# Path: tests/cases/resources/tests/context.py
import json
from restlib2.http import codes
from avocado.models import DataContext
from .base import AuthenticatedBaseTestCase

        cxt.save()

        response = self.client.get('/api/contexts/{0}/stats/'.format(cxt.pk),
                                   HTTP_ACCEPT='application/json')

        self.assertEqual(json.loads(response.content)['count'], 6)

    def test_session(self):
        cxt = DataContext(session=True, user=self.user)
        cxt.save()

        response = self.client.get('/api/contexts/session/stats/',
                                   HTTP_ACCEPT='application/json')

        self.assertEqual(json.loads(response.content)['count'], 6)

    def test_processor(self):
        cxt = DataContext(session=True, user=self.user)
        cxt.save()

        response = self.client.get('/api/contexts/{0}/stats/'.format(cxt.pk),
                                   HTTP_ACCEPT='application/json')
        self.assertEqual(json.loads(response.content)['count'], 6)

        response = self.client.get('/api/contexts/{0}/stats/?processor=manager'
                                   .format(cxt.pk),
                                   HTTP_ACCEPT='application/json')
        self.assertEqual(json.loads(response.content)['count'], 1)



class ContextsRevisionsResourceTestCase(AuthenticatedBaseTestCase):