Replace yaml fixtures with json fixtures

This commit is contained in:
Andreas Zweili 2024-03-11 17:18:17 +01:00
parent 0970874401
commit 92ef2716d4
3 changed files with 2792 additions and 555 deletions

2778
src/network_inventory.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,554 +0,0 @@
- model: backups.notificationtype
pk: 1
fields:
name: Email
- model: backups.notification
pk: 1
fields:
name: Support Email
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
recipient: support@pharma.com
notification_type: 1
- model: backups.backup
pk: 1
fields:
name: Daily Backup
computer: 1
method: 1
software: 16
source_path: c:/User
exec_time: '11:21:52'
exec_days:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- model: backups.backup
pk: 2
fields:
name: Weekly Backup
computer: 2
method: 1
software: 16
source_path: c:/
exec_time: 00:00:00
exec_days:
- 4
- model: backups.notificationfrombackup
pk: 1
fields:
backup: 1
notification: 1
- model: backups.notificationfrombackup
pk: 2
fields:
backup: 2
notification: 1
- model: computers.disk
pk: 1
fields:
disk_type: 1
size_in_gb: 256
- model: computers.disk
pk: 2
fields:
disk_type: 2
size_in_gb: 1000
- model: computers.gpu
pk: 1
fields:
name: GTX 1080
manufacturer: 3
- model: computers.computer
pk: 1
fields:
os: 12
host: null
allocated_space: null
- model: computers.computer
pk: 2
fields:
os: 12
host: null
allocated_space: null
- model: computers.computer
pk: 3
fields:
os: 3
host: null
allocated_space: null
- model: computers.computercpurelation
pk: 1
fields:
cpu: 1
computer: 1
amount: 1
- model: computers.computercpurelation
pk: 2
fields:
cpu: 1
computer: 2
amount: 1
- model: computers.computercpurelation
pk: 3
fields:
cpu: 2
computer: 3
amount: 1
- model: computers.computerramrelation
pk: 9
fields:
ram: 4
computer: 1
amount: 2
- model: computers.computerramrelation
pk: 10
fields:
ram: 5
computer: 2
amount: 2
- model: computers.computerramrelation
pk: 11
fields:
ram: 6
computer: 3
amount: 1
- model: computers.computerdiskrelation
pk: 1
fields:
disk: 1
computer: 1
amount: 1
- model: computers.computerdiskrelation
pk: 2
fields:
disk: 1
computer: 2
amount: 3
- model: computers.computerdiskrelation
pk: 3
fields:
disk: 2
computer: 3
amount: 1
- model: computers.computersoftwarerelation
pk: 1
fields:
software: 7
computer: 1
architecture: 2
- model: computers.computersoftwarerelation
pk: 2
fields:
software: 7
computer: 2
architecture: 1
- model: computers.computersoftwarerelation
pk: 3
fields:
software: 26
computer: 2
architecture: 2
- model: computers.computersoftwarerelation
pk: 4
fields:
software: 12
computer: 3
architecture: 1
- model: computers.computergpurelation
pk: 1
fields:
gpu: 1
computer: 1
amount: 1
- model: computers.computergpurelation
pk: 2
fields:
gpu: 1
computer: 2
amount: 1
- model: computers.computergpurelation
pk: 3
fields:
gpu: 1
computer: 3
amount: 1
- model: customers.customer
pk: 1
fields:
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
name: Pharma Company
- model: customers.customer
pk: 2
fields:
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
name: Water Company
- model: customers.location
pk: 1
fields:
name: Pharma Office
customer: 1
- model: customers.location
pk: 2
fields:
name: Water Office
customer: 2
- model: devices.devicecategory
pk: 1
fields:
name: Office PC
- model: devices.devicecategory
pk: 2
fields:
name: CAD PC
- model: devices.hardwaremodel
pk: 1
fields:
name: Latidude 5530
manufacturer: 1
- model: devices.hardwaremodel
pk: 2
fields:
name: Optiplex 7070
manufacturer: 1
- model: devices.hardwaremodel
pk: 3
fields:
name: Cumpact2700
manufacturer: 3
- model: devices.device
pk: 1
fields:
name: pharma-pc1
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
serialnumber: ADSF124
category: 1
owner: null
customer: 1
manufacturer: 1
model: 1
location: 1
user: 1
installation_date: 2020-06-15
- model: devices.device
pk: 2
fields:
name: pharma-pc2
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
serialnumber: ADSF125
category: 2
owner: null
customer: 1
manufacturer: 1
model: 2
location: 1
user: 2
installation_date: 2020-06-01
- model: devices.device
pk: 3
fields:
name: water-pc1
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
serialnumber: asfasf
category: 1
owner: null
customer: 2
manufacturer: 3
model: 3
location: 2
user: 3
installation_date: 2020-06-15
- model: devices.deviceinnet
pk: 1
fields:
device: 1
net: 1
ip: 10.60.0.2
nic: eth0
mac_address: A1:B2:C3:D4:E5:F6
ip_status: 1
- model: devices.deviceinnet
pk: 2
fields:
device: 2
net: 1
ip: 10.60.0.3
nic: eth0
mac_address: A1:B2:C3:D4:E5:F6
ip_status: 1
- model: devices.deviceinnet
pk: 3
fields:
device: 3
net: 2
ip: 192.168.1.12
nic: eth0
mac_address: A1:B2:C3:D4:E5:F6
ip_status: 2
- model: devices.warrantytype
pk: 1
fields:
name: Dell Pro Support
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
- model: devices.warrantytype
pk: 2
fields:
name: Dell NDB Support
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
- model: devices.warranty
pk: 1
fields:
customer: 2
device: 3
valid_from: 2020-06-01
valid_until: 2022-12-01
warranty_type: 1
- model: devices.warranty
pk: 2
fields:
customer: 1
device: 1
valid_from: 2020-05-01
valid_until: 2020-05-29
warranty_type: 2
- model: devices.warranty
pk: 3
fields:
customer: 1
device: 2
valid_from: 2020-06-01
valid_until: 2023-07-13
warranty_type: 2
- model: licenses.userlicense
pk: 1
fields:
customer: 1
key: 1234-5678-9012-3456
software: 7
max_allowed_users: 3
- model: licenses.userlicense
pk: 2
fields:
customer: 1
key: sadf-sd-f-sdf--sdfs-df
software: 26
max_allowed_users: 5
- model: licenses.userlicense
pk: 3
fields:
customer: 2
key: 1234-5678-9012-3456
software: 15
max_allowed_users: 1
- model: licenses.computerlicense
pk: 1
fields:
customer: 1
key: 1234-5678-9012-3456
software: 7
max_allowed_computers: 5
- model: licenses.computerlicense
pk: 2
fields:
customer: 2
key: 1234-5678-9012-3456
software: 12
max_allowed_computers: 1
- model: licenses.licensewithuser
pk: 1
fields:
user: 1
license: 1
- model: licenses.licensewithuser
pk: 2
fields:
user: 2
license: 2
- model: licenses.licensewithuser
pk: 3
fields:
user: 2
license: 1
- model: licenses.licensewithuser
pk: 4
fields:
user: 3
license: 3
- model: licenses.licensewithcomputer
pk: 1
fields:
computer: 1
license: 1
- model: licenses.licensewithcomputer
pk: 2
fields:
computer: 2
license: 1
- model: licenses.licensewithcomputer
pk: 3
fields:
computer: 3
license: 2
- model: nets.ipstatus
pk: 1
fields:
name: Fixed in Device
- model: nets.ipstatus
pk: 2
fields:
name: Reserved
- model: nets.ipstatus
pk: 3
fields:
name: Fixed in Device + Reserved
- model: nets.ipstatus
pk: 4
fields:
name: Dynamic
- model: nets.net
pk: 1
fields:
name: Pharma Net
ip_range: 10.60.0.0/16
dhcp_range: 10.60.255.1-254
customer: 1
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
- model: nets.net
pk: 2
fields:
name: WaterNET
ip_range: 192.168.1.0/24
dhcp_range: 192.168.1.1-254
customer: 2
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
- model: softwares.softwarecategory
pk: 4
fields:
name: CAD
- model: softwares.software
pk: 26
fields:
name: AutoCAD
category: 4
- model: users.group
pk: 1
fields:
name: HR
customer: 1
- model: users.group
pk: 2
fields:
name: Engineering
customer: 1
- model: users.group
pk: 3
fields:
name: HR
customer: 2
- model: users.group
pk: 1
fields:
name: HR
customer: 1
mail_address: hr@pharma.com
- model: users.group
pk: 2
fields:
name: Engineering
customer: 1
mail_address: engineering@pharma.com
- model: users.group
pk: 3
fields:
name: HR
customer: 2
mail_address: hr@water.com
- model: users.user
pk: 1
fields:
name: Muster
first_name: Max
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
customer: 1
- model: users.user
pk: 2
fields:
name: Meier
first_name: Anna
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
customer: 1
- model: users.user
pk: 3
fields:
name: "Pfl\xFCmli"
first_name: Karin
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
customer: 2

View File

@ -3,7 +3,7 @@
# Helper functions not exposed to the user {
# Load example data
_init() {
python ./src/manage.py loaddata src/network_inventory.yaml
python ./src/manage.py loaddata src/network_inventory.json
}
_open_url() {
@ -145,6 +145,19 @@ open-port() {
descriptions["op"]="(o)pen the (p)ort in iptables fireall."
tasks["op"]=open-port
dump-fixtures() {
python "$DEVENV_ROOT"/src/manage.py dumpdata \
--all \
--indent 2 \
--exclude=admin.logentry \
--exclude=contenttypes \
--exclude=auth \
--exclude=core \
>"$DEVENV_ROOT"/src/network_inventory.json
}
descriptions["df"]="(d)ump data into (f)ixtures"
tasks["df"]=dump-fixtures
# only one task at a time
if [ $# != 1 ]; then
printf "usage: dev <task_name>\n\n"