Browse Source

make genfixtures use ObjectStore so it's like what the cli uses..

main
John-Mark Gurney 5 years ago
parent
commit
665a46e86d
2 changed files with 18 additions and 14 deletions
  1. +1
    -1
      ui/Makefile
  2. +17
    -13
      ui/fixtures/genfixtures.py

+ 1
- 1
ui/Makefile View File

@@ -8,4 +8,4 @@ env:
pip install -r requirements.txt)

fixtures/sample.data.pasn1: fixtures/genfixtures.py
(. ./p/bin/activate && cd fixtures && python genfixtures.py )
(. ./p/bin/activate && cd fixtures && PYTHONPATH=.. python genfixtures.py )

+ 17
- 13
ui/fixtures/genfixtures.py View File

@@ -1,16 +1,20 @@
import pasn1
import cli
import datetime

open('sample.data.pasn1', 'w').write(pasn1.dumps(
[
{
'type': 'metadata',
'uuid': '3e466e06-45de-4ecc-84ba-2d2a3d970e96',
'created_by_ref': '867c7563-79ae-435c-a265-9d8509cefac5',
'modified': datetime.datetime(2019, 5, 31, 14, 5, 3),
'dc:author': u'John-Mark Gurney',
'hashes': [ 'sha256:91751cee0a1ab8414400238a761411daa29643ab4b8243e9a91649e25be53ada' ],
'lang': 'en'
}
]
))
objst = cli.ObjectStore()
map(objst.loadobj,
[
{
'type': 'metadata',
'uuid': '3e466e06-45de-4ecc-84ba-2d2a3d970e96',
'created_by_ref': '867c7563-79ae-435c-a265-9d8509cefac5',
'modified': datetime.datetime(2019, 5, 31, 14, 5, 3),
'dc:author': u'John-Mark Gurney',
'hashes': [ 'sha256:91751cee0a1ab8414400238a761411daa29643ab4b8243e9a91649e25be53ada' ],
'lang': 'en'
}
]
)

objst.store('sample.data.pasn1')

Loading…
Cancel
Save