Example #1
0
class ShipItActionTests(ReadOnlyActionTestsMixin, ActionsTestCase):
    """Unit tests for ShipItAction."""

    action = ShipItAction()
    fixtures = ['test_users']

    def _create_request_context(self, *args, **kwargs):
        """Create and return objects for use in the request context.

        Args:
            *args (tuple):
                Positional arguments (unused).

            **kwargs (dict):
                Keyword arguments (unused).

        Returns:
            dict:
            Additional context to use when testing read-only actions.
        """
        return {
            'request': self.request,
        }

    def test_should_render_with_authenticated(self):
        """Testing ShipItAction.should_render with authenticated user"""
        self.request.user = User.objects.get(username='******')
        self.assertTrue(
            self.action.should_render(self._create_request_context()))

    def test_should_render_with_anonymous(self):
        """Testing ShipItAction.should_render with authenticated user"""
        self.request.user = AnonymousUser()
        self.assertFalse(
            self.action.should_render(self._create_request_context()))
Example #2
0
class ShipItActionTests(ActionsTestCase):
    """Unit tests for ShipItAction."""

    fixtures = ['test_users']

    def setUp(self):
        super(ShipItActionTests, self).setUp()

        self.action = ShipItAction()

    def test_should_render_with_authenticated(self):
        """Testing ShipItAction.should_render with authenticated user"""
        request = RequestFactory().request()
        request.user = User.objects.get(username='******')

        self.assertTrue(self.action.should_render({'request': request}))

    def test_should_render_with_anonymous(self):
        """Testing ShipItAction.should_render with authenticated user"""
        request = RequestFactory().request()
        request.user = AnonymousUser()

        self.assertFalse(self.action.should_render({'request': request}))
Example #3
0
class ShipItActionTests(ActionsTestCase):
    """Unit tests for ShipItAction."""

    fixtures = ['test_users']

    def setUp(self):
        super(ShipItActionTests, self).setUp()

        self.action = ShipItAction()

    def test_should_render_with_authenticated(self):
        """Testing ShipItAction.should_render with authenticated user"""
        request = RequestFactory().request()
        request.user = User.objects.get(username='******')

        self.assertTrue(self.action.should_render({'request': request}))

    def test_should_render_with_anonymous(self):
        """Testing ShipItAction.should_render with authenticated user"""
        request = RequestFactory().request()
        request.user = AnonymousUser()

        self.assertFalse(self.action.should_render({'request': request}))
Example #4
0
    def setUp(self):
        super(ShipItActionTests, self).setUp()

        self.action = ShipItAction()
Example #5
0
    def setUp(self):
        super(ShipItActionTests, self).setUp()

        self.action = ShipItAction()
Example #6
0
 def shutdown(self):
     super(ExtendedApproval, self).shutdown()
     self._replace_action(ShipItAction())