-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2620 from bcgov/test-data
Test data
- Loading branch information
Showing
19 changed files
with
2,620 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.core.management import call_command | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Load fixtures for specified workflow or all fixtures if no argument provided' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('workflow', nargs='?', type=str, help='Name of the workflow') | ||
|
||
def handle(self, *args, **options): | ||
fixture_base_dir = 'registration/fixtures/mock/v1' | ||
fixtures_base = [ # Order of fixtures is important | ||
f'{fixture_base_dir}/address.json', | ||
f'{fixture_base_dir}/user.json', | ||
f'{fixture_base_dir}/contact.json', | ||
f'{fixture_base_dir}/bc_obps_regulated_operation.json', | ||
f'{fixture_base_dir}/bc_greenhouse_gas_id.json', | ||
f'{fixture_base_dir}/operator.json', | ||
f'{fixture_base_dir}/operation.json', | ||
f'{fixture_base_dir}/multiple_operator.json', | ||
f'{fixture_base_dir}/document.json', | ||
f'{fixture_base_dir}/user_operator.json', | ||
f'{fixture_base_dir}/parent_operator.json', | ||
f'{fixture_base_dir}/partner_operator.json', | ||
] | ||
|
||
workflow_fixtures = { | ||
"cas_admin": [ | ||
f'{fixture_base_dir}/address.json', | ||
f'{fixture_base_dir}/user.json', | ||
f'{fixture_base_dir}/contact.json', | ||
f'{fixture_base_dir}/bc_obps_regulated_operation.json', | ||
f'{fixture_base_dir}/bc_greenhouse_gas_id.json', | ||
f'{fixture_base_dir}/operator.json', | ||
f'{fixture_base_dir}/operation.json', | ||
f'{fixture_base_dir}/user_operator.json', | ||
], | ||
"admin-industry_user": [ | ||
( | ||
fixture.replace('user_operator.json', 'admin/user_operator.json') | ||
if 'user_operator.json' in fixture | ||
else fixture | ||
) | ||
for fixture in fixtures_base | ||
], | ||
"admin-industry_user_operator": [ | ||
( | ||
fixture.replace('user_operator.json', 'admin/user_operator_approved.json') | ||
if 'user_operator.json' in fixture | ||
else fixture | ||
) | ||
for fixture in fixtures_base | ||
], | ||
# Add more workflows here | ||
} | ||
|
||
if 'workflow' in options and options['workflow'] in workflow_fixtures: | ||
fixtures = workflow_fixtures[options['workflow']] | ||
else: | ||
# If no workflow specified, load all fixtures | ||
|
||
fixtures = fixtures_base | ||
|
||
for fixture in fixtures: | ||
self.stdout.write(self.style.SUCCESS(f"Loading: {fixture}")) | ||
call_command('loaddata', fixture) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
[ | ||
{ | ||
"model": "registration.address", | ||
"pk": 1, | ||
"fields": { | ||
"street_address": "123 Main St", | ||
"municipality": "Cityville", | ||
"province": "ON", | ||
"postal_code": "A1B 2C3" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 2, | ||
"fields": { | ||
"street_address": "456 Elm St", | ||
"municipality": "Townsville", | ||
"province": "BC", | ||
"postal_code": "X0Y 1Z0" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 3, | ||
"fields": { | ||
"street_address": "123 Main St", | ||
"municipality": "City", | ||
"province": "ON", | ||
"postal_code": "A1B 2C3" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 4, | ||
"fields": { | ||
"street_address": "789 Oak St", | ||
"municipality": "Village", | ||
"province": "BC", | ||
"postal_code": "M2N 3P4" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 5, | ||
"fields": { | ||
"street_address": "101 Maple St", | ||
"municipality": "Hamlet", | ||
"province": "QC", | ||
"postal_code": "H3Z 2Y7" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 6, | ||
"fields": { | ||
"street_address": "202 Pine St", | ||
"municipality": "Borough", | ||
"province": "AB", | ||
"postal_code": "T5K 1P2" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 7, | ||
"fields": { | ||
"street_address": "303 Cedar St", | ||
"municipality": "Metropolis", | ||
"province": "ON", | ||
"postal_code": "M4B 1B3" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 8, | ||
"fields": { | ||
"street_address": "404 Birch St", | ||
"municipality": "Uptown", | ||
"province": "BC", | ||
"postal_code": "V6B 2W3" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 9, | ||
"fields": { | ||
"street_address": "505 Spruce St", | ||
"municipality": "Downtown", | ||
"province": "ON", | ||
"postal_code": "K1A 0B1" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 10, | ||
"fields": { | ||
"street_address": "606 Fir St", | ||
"municipality": "Suburbia", | ||
"province": "QC", | ||
"postal_code": "G1V 4N7" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 11, | ||
"fields": { | ||
"street_address": "707 Willow St", | ||
"municipality": "Riverside", | ||
"province": "MB", | ||
"postal_code": "R3C 4A5" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 12, | ||
"fields": { | ||
"street_address": "808 Poplar St", | ||
"municipality": "Lakeside", | ||
"province": "NS", | ||
"postal_code": "B3H 2Y9" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 13, | ||
"fields": { | ||
"street_address": "909 Aspen St", | ||
"municipality": "Hillside", | ||
"province": "NB", | ||
"postal_code": "E3B 1A1" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 14, | ||
"fields": { | ||
"street_address": "1010 Redwood St", | ||
"municipality": "Seaside", | ||
"province": "PE", | ||
"postal_code": "C1A 7N8" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 15, | ||
"fields": { | ||
"street_address": "1111 Chestnut St", | ||
"municipality": "Mountainview", | ||
"province": "NL", | ||
"postal_code": "A1C 5H7" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 16, | ||
"fields": { | ||
"street_address": "1212 Walnut St", | ||
"municipality": "Forestville", | ||
"province": "SK", | ||
"postal_code": "S7K 3R5" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 17, | ||
"fields": { | ||
"street_address": "1313 Hickory St", | ||
"municipality": "Prairie", | ||
"province": "MB", | ||
"postal_code": "R2C 4A6" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 18, | ||
"fields": { | ||
"street_address": "1414 Sycamore St", | ||
"municipality": "Baytown", | ||
"province": "ON", | ||
"postal_code": "L4W 5N8" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 19, | ||
"fields": { | ||
"street_address": "1515 Magnolia St", | ||
"municipality": "Harbor", | ||
"province": "BC", | ||
"postal_code": "V8W 1N4" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 20, | ||
"fields": { | ||
"street_address": "1616 Dogwood St", | ||
"municipality": "Cove", | ||
"province": "QC", | ||
"postal_code": "J4Z 2Y8" | ||
} | ||
}, | ||
{ | ||
"model": "registration.address", | ||
"pk": 21, | ||
"fields": { | ||
"street_address": "1717 Alder St", | ||
"municipality": "Grove", | ||
"province": "ON", | ||
"postal_code": "N2L 3G1" | ||
} | ||
} | ||
] |
Oops, something went wrong.