def test_inject_none_when_not_logged_user(self):
        "Should inject None on user variable in the template context when there is not a logged in user"
        from google.appengine.api.users import UserNotFoundError
        google_user = self.mocker.replace('google.appengine.api.users.User')
        google_user()
        self.mocker.throw(UserNotFoundError)
        self.mocker.replay()

        from talks_application.context_processors import inject_user
        assert_equals(inject_user(), dict(user=None))
        self.mocker.verify()
    def test_inject_logged_user(self):
        "Should inject the current user in the template context when there is a logged in user"
        from google.appengine.api.users import User
        user = self.mocker.mock(User)
        google_user = self.mocker.replace('google.appengine.api.users.User')
        google_user()
        self.mocker.result(user)
        self.mocker.replay()

        from talks_application.context_processors import inject_user
        assert_equals(inject_user(), dict(user=user))
        self.mocker.verify()