Browse Source

add created_by_ref, and some previously missing files..

main
John-Mark Gurney 5 years ago
parent
commit
762e422586
5 changed files with 32 additions and 1 deletions
  1. +11
    -0
      ui/Makefile
  2. +2
    -1
      ui/cli.py
  3. +16
    -0
      ui/fixtures/genfixtures.py
  4. +1
    -0
      ui/fixtures/testfiles/test.txt
  5. +2
    -0
      ui/requirements.txt

+ 11
- 0
ui/Makefile View File

@@ -0,0 +1,11 @@
test: fixtures/sample.data.pasn1
(. ./p/bin/activate && \
(echo cli.py | entr python -m unittest cli))

env:
virtualenv p
(. ./p/bin/activate && \
pip install -r requirements.txt)

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

+ 2
- 1
ui/cli.py View File

@@ -22,7 +22,7 @@ class MDBase(object):
'''This is a simple wrapper that turns a JSON object into a pythonesc
object where attribute accesses work.'''

_common_properties = [ 'uuid', 'type', 'modified' ]
_common_properties = [ 'uuid', 'type', 'modified', 'created_by_ref' ]

def __init__(self, obj):
for x in self._common_properties:
@@ -266,6 +266,7 @@ class _TestCases(unittest.TestCase):
'type': 'metadata',
'uuid': 'c9a1d1e2-3109-4efd-8948-577dc15e44e7',
'modified': datetime.datetime(2019, 5, 31, 14, 3, 10),
'created_by_ref': '867c7563-79ae-435c-a265-9d8509cefac5',
'hashes': [ 'sha256:91751cee0a1ab8414400238a761411daa29643ab4b8243e9a91649e25be53ada' ],
'lang': 'en',
})


+ 16
- 0
ui/fixtures/genfixtures.py View File

@@ -0,0 +1,16 @@
import pasn1
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'
}
]
))

+ 1
- 0
ui/fixtures/testfiles/test.txt View File

@@ -0,0 +1 @@
this is a test

+ 2
- 0
ui/requirements.txt View File

@@ -0,0 +1,2 @@
urwid
-e git://github.com/jmgurney/pasn1@27ff594a2609c07205753ce24f74d8f45a7ea418#egg=pasn1

Loading…
Cancel
Save