From b196542143137ab215f3c9c62012e387c836b04b Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Mon, 11 May 2020 14:23:21 +0000 Subject: [PATCH] Added a utility script to dump a normalized names.json fixture - Legacy-Id: 17775 --- bin/dump-to-names-json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bin/dump-to-names-json diff --git a/bin/dump-to-names-json b/bin/dump-to-names-json new file mode 100644 index 000000000..9c7dfac07 --- /dev/null +++ b/bin/dump-to-names-json @@ -0,0 +1,16 @@ +#!/bin/bash + +# This script provides a limited selected dump of database content with the +# purpose of generating a test fixture that provides the test data needed +# by the test suite. +# +# The generated data fixture is sorted and normalized in order to produce +# minimal commit diffs which reflect only actual changes in the fixture data, +# without apparent changes resulting only from ordering changes. + +set -x +ietf/manage.py dumpdata --indent 1 doc.State doc.BallotType doc.StateType \ + mailtrigger.MailTrigger mailtrigger.Recipient name utils.VersionInfo \ + group.GroupFeatures stats.CountryAlias dbtemplate.DBTemplate \ + | jq --sort-keys "sort_by(.model, .pk)" \ + | jq '[.[] | select(.model!="dbtemplate.dbtemplate" or .pk==354)]' > ietf/name/fixtures/names.json