def test_can_register_installations_with_authenticated_user_and_event_without_installations_should_return_false( event1, mocker): event1.use_installations = False event1.save() user = mocker.MagicMock() user.is_authenticated = True assert not filters.can_register_installations(user, event1)
def test_can_register_installations_with_authenticated_intaller_and_event_with_installations_should_return_true(event1, mocker): mock_is_installer = mocker.patch('manager.templatetags.filters.is_installer') mock_is_installer.return_value = True event1.use_installations = True event1.save() user = mocker.MagicMock() user.is_authenticated = True assert filters.can_register_installations(user, event1) mock_is_installer.assert_called_once_with(user, event1.event_slug)
def test_can_register_installations_with_anonymous_user_should_return_false( event1): anonymous_user = AnonymousUser() assert not filters.can_register_installations(anonymous_user, event1)