aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/log.h
blob: 9bce9e12620544bec57488052e4abcfc1f106c5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *  Jabber
 *  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
 */

#ifndef INCL_LOG_H
#define INCL_LOG_H

#define LOGSIZE_HDR 1024
#define LOGSIZE_TAIL 2048


#ifdef DEBUG
	void jdebug(char *zone, const char *msgfmt, ...);
#else
	#define jdebug if(0) warn
#endif



#endif	/* INCL_LOG_H */
ption> Unnamed repository; edit this file 'description' to name the repository.MimesBrønn
aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/create_request_spec.rb
blob: 4efbf94ee11c7681cad9b2ec10500aa0e9a488eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "When creating requests" do

    def create_request_unregistered
      params = { :info_request => { :public_body_id => public_bodies(:geraldine_public_body).id,
                                    :title => "Why is your quango called Geraldine?",
                                    :tag_string => "" },
                 :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
                 :submitted_new_request => 1,
                 :preview => 0
      }

      # Initially we are not logged in. Try to create a new request.
      post "/new", params
      # We expect to be redirected to the login page
      post_redirect = PostRedirect.get_last_post_redirect
      response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
      follow_redirect!
      response.should render_template("user/sign")
      response.body.should match(/To send your FOI request, please sign in or make a new account./)
    end

    it "should associate the request with the requestor, even if it is approved by an admin" do
        # This is a test for https://github.com/mysociety/alaveteli/issues/446
        create_request_unregistered
        post_redirect = PostRedirect.get_last_post_redirect
        # Now log in as an unconfirmed user.
        post "/profile/sign_in", :user_signin => {:email => users(:unconfirmed_user).email, :password => "jonespassword"}, :token => post_redirect.token
        # This will trigger a confirmation mail. Get the PostRedirect for later.
        response.should render_template("user/confirm")
        post_redirect = PostRedirect.get_last_post_redirect

        # Now log in as an admin user, then follow the confirmation link in the email that was sent to the unconfirmed user
        admin_user = users(:admin_user)
        admin_user.email_confirmed = true
        admin_user.save!
        post_via_redirect "/profile/sign_in", :user_signin => {:email => admin_user.email, :password => "jonespassword"}
        response.should be_success
        get "/c/" + post_redirect.email_token
        follow_redirect!
        response.location.should =~ %r(/request/(.+)/new)
        response.location =~ %r(/request/(.+)/new)
        url_title = $1
        info_request = InfoRequest.find_by_url_title(url_title)
        info_request.should_not be_nil

        # Make sure the request is still owned by the user who made it, not the admin who confirmed it
        info_request.user_id.should == users(:unconfirmed_user).id
    end
end