diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-09-15 13:16:00 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-09-20 14:06:37 +0100 |
commit | 33be8df8f21f6ec5cee9c4675847b8e26f72f96b (patch) | |
tree | f481306cbd75199abb7f8f4b1627c4e4ef6355d5 | |
parent | 0deb52d82c31766a3141941334e5f4f11bfc77e1 (diff) |
[fixmystreet.com] Noddy fixture script.
-rwxr-xr-x | bin/fixmystreet.com/fixture | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture new file mode 100755 index 000000000..93982af8a --- /dev/null +++ b/bin/fixmystreet.com/fixture @@ -0,0 +1,39 @@ +#!/usr/bin/env perl +# +# This script will create a test body and its categories, covering the area of +# Westminster, and a user associated with that body, which should help testing +# of report interactions. + +use strict; +use warnings; + +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../../setenv.pl"; +} + +use FixMyStreet::DB; + +my $body = FixMyStreet::DB->resultset("Body")->find_or_create({ name => 'Test City Council' }); +$body->body_areas->find_or_create({ area_id => 2504 }); +foreach ("Potholes", "Street lighting", "Graffiti") { + (my $email = lc $_) =~ s/ /-/g; + $body->contacts->find_or_create({ + category => $_, + email => $email . '@example.net', + confirmed => 't', + deleted => 'f', + whenedited => \'current_timestamp', + editor => 'fixture', + note => 'Created by fixture' + }); +} + +FixMyStreet::DB->resultset("User")->find_or_create({ + email => 'council@example.net', + name => 'Test City Council User', + from_body => $body, + password => 'password', +}); |