Commit 677c647df194a5f5f27ee21243982340157d2ca5
1 parent
6af4a830
Exists in
master
and in
28 other branches
ActionItem558: upgraded the test data
upgraded the script anhategua that loads test data to create states instead of region and make ze environment admin git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2299 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
33 additions
and
27 deletions
Show diff stats
script/anhetegua
@@ -24,6 +24,10 @@ def new_region(parent, name, color = nil) | @@ -24,6 +24,10 @@ def new_region(parent, name, color = nil) | ||
24 | region | 24 | region |
25 | end | 25 | end |
26 | 26 | ||
27 | +def new_state(parent, name) | ||
28 | + State.create!(:name => name, :parent => parent, :environment => Environment.default) | ||
29 | +end | ||
30 | + | ||
27 | def new_validator(region, name, identifier, klass = Organization) | 31 | def new_validator(region, name, identifier, klass = Organization) |
28 | org = klass.new(:name => name, :identifier => identifier) | 32 | org = klass.new(:name => name, :identifier => identifier) |
29 | org.validation_info = ValidationInfo.new(:validation_methodology => 'some methodology we don\'t care about') | 33 | org.validation_info = ValidationInfo.new(:validation_methodology => 'some methodology we don\'t care about') |
@@ -84,37 +88,37 @@ territorios = new_region(nil, 'Territórios', 2) | @@ -84,37 +88,37 @@ territorios = new_region(nil, 'Territórios', 2) | ||
84 | nacional = new_region(territorios, 'Nacional') | 88 | nacional = new_region(territorios, 'Nacional') |
85 | internacional = new_region(territorios, 'Internacional') | 89 | internacional = new_region(territorios, 'Internacional') |
86 | centro_oeste = new_region(nacional, 'Região Centro-Oeste') | 90 | centro_oeste = new_region(nacional, 'Região Centro-Oeste') |
87 | -mt = new_region(centro_oeste, 'Mato Grosso') | ||
88 | -ms = new_region(centro_oeste, 'Mato Grosso do Sul') | ||
89 | -go = new_region(centro_oeste, 'Goiás') | ||
90 | -df = new_region(centro_oeste, 'Distrito Federal') | 91 | +mt = new_state(centro_oeste, 'Mato Grosso') |
92 | +ms = new_state(centro_oeste, 'Mato Grosso do Sul') | ||
93 | +go = new_state(centro_oeste, 'Goiás') | ||
94 | +df = new_state(centro_oeste, 'Distrito Federal') | ||
91 | nordeste = new_region(nacional, 'Região Nordeste') | 95 | nordeste = new_region(nacional, 'Região Nordeste') |
92 | -al = new_region(nordeste, 'Alagoas') | ||
93 | -ba = new_region(nordeste, 'Bahia') | ||
94 | -ce = new_region(nordeste, 'Ceará') | ||
95 | -ma = new_region(nordeste, 'Maranhão') | ||
96 | -pb = new_region(nordeste, 'Paraíba') | ||
97 | -pe = new_region(nordeste, 'Pernambuco') | ||
98 | -pi = new_region(nordeste, 'Piauí') | ||
99 | -rn = new_region(nordeste, 'Rio Grande do Norte') | ||
100 | -se = new_region(nordeste, 'Sergipe') | 96 | +al = new_state(nordeste, 'Alagoas') |
97 | +ba = new_state(nordeste, 'Bahia') | ||
98 | +ce = new_state(nordeste, 'Ceará') | ||
99 | +ma = new_state(nordeste, 'Maranhão') | ||
100 | +pb = new_state(nordeste, 'Paraíba') | ||
101 | +pe = new_state(nordeste, 'Pernambuco') | ||
102 | +pi = new_state(nordeste, 'Piauí') | ||
103 | +rn = new_state(nordeste, 'Rio Grande do Norte') | ||
104 | +se = new_state(nordeste, 'Sergipe') | ||
101 | norte = new_region(nacional, 'Região Norte') | 105 | norte = new_region(nacional, 'Região Norte') |
102 | -ac = new_region(norte, 'Acre') | ||
103 | -ap = new_region(norte, 'Amapá') | ||
104 | -am = new_region(norte, 'Amazonas') | ||
105 | -pa = new_region(norte, 'Pará') | ||
106 | -ro = new_region(norte, 'Rondônia') | ||
107 | -rr = new_region(norte, 'Roraima') | ||
108 | -to = new_region(norte, 'Tocantins') | 106 | +ac = new_state(norte, 'Acre') |
107 | +ap = new_state(norte, 'Amapá') | ||
108 | +am = new_state(norte, 'Amazonas') | ||
109 | +pa = new_state(norte, 'Pará') | ||
110 | +ro = new_state(norte, 'Rondônia') | ||
111 | +rr = new_state(norte, 'Roraima') | ||
112 | +to = new_state(norte, 'Tocantins') | ||
109 | sudeste = new_region(nacional, 'Região Sudeste') | 113 | sudeste = new_region(nacional, 'Região Sudeste') |
110 | -mg = new_region(sudeste, 'Minas Gerais') | ||
111 | -sp = new_region(sudeste, 'São Paulo') | ||
112 | -rj = new_region(sudeste, 'Rio de Janeiro') | ||
113 | -es = new_region(sudeste, 'Espírito Santo') | 114 | +mg = new_state(sudeste, 'Minas Gerais') |
115 | +sp = new_state(sudeste, 'São Paulo') | ||
116 | +rj = new_state(sudeste, 'Rio de Janeiro') | ||
117 | +es = new_state(sudeste, 'Espírito Santo') | ||
114 | sul = new_region(nacional, 'Região Sul') | 118 | sul = new_region(nacional, 'Região Sul') |
115 | -pr = new_region(sul, 'Paraná') | ||
116 | -rs = new_region(sul, 'Rio Grande do Sul') | ||
117 | -sc = new_region(sul, 'Santa Catarina') | 119 | +pr = new_state(sul, 'Paraná') |
120 | +rs = new_state(sul, 'Rio Grande do Sul') | ||
121 | +sc = new_state(sul, 'Santa Catarina') | ||
118 | 122 | ||
119 | cadeias = new_category(nil, 'Redes/Cadeias', 3) | 123 | cadeias = new_category(nil, 'Redes/Cadeias', 3) |
120 | new_category(cadeias, 'Agropecuária, extrativismo e pesca') | 124 | new_category(cadeias, 'Agropecuária, extrativismo e pesca') |
@@ -150,6 +154,8 @@ owner_role = Profile::Roles.admin | @@ -150,6 +154,8 @@ owner_role = Profile::Roles.admin | ||
150 | 154 | ||
151 | # Sample user and sample enterprise owned by him | 155 | # Sample user and sample enterprise owned by him |
152 | ze = User.create!(:login => 'ze', :email => 'ze@localhost.localdomain', :password => 'test', :password_confirmation => 'test').person | 156 | ze = User.create!(:login => 'ze', :email => 'ze@localhost.localdomain', :password => 'test', :password_confirmation => 'test').person |
157 | + | ||
158 | +Environment.default.affiliate(ze, Environment::Roles.admin) | ||
153 | empa = Enterprise.create!(:name => 'Cooperativa A', :identifier => 'coop_a') | 159 | empa = Enterprise.create!(:name => 'Cooperativa A', :identifier => 'coop_a') |
154 | 160 | ||
155 | empa.affiliate(ze, owner_role) | 161 | empa.affiliate(ze, owner_role) |