From 762e422586fc5d1d7b324aedddb106ffce8eeb33 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Sun, 2 Jun 2019 14:13:07 -0700 Subject: [PATCH] add created_by_ref, and some previously missing files.. --- ui/Makefile | 11 +++++++++++ ui/cli.py | 3 ++- ui/fixtures/genfixtures.py | 16 ++++++++++++++++ ui/fixtures/testfiles/test.txt | 1 + ui/requirements.txt | 2 ++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 ui/Makefile create mode 100644 ui/fixtures/genfixtures.py create mode 100644 ui/fixtures/testfiles/test.txt create mode 100644 ui/requirements.txt diff --git a/ui/Makefile b/ui/Makefile new file mode 100644 index 0000000..075aa05 --- /dev/null +++ b/ui/Makefile @@ -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 ) diff --git a/ui/cli.py b/ui/cli.py index 7605e8f..6a7adf0 100644 --- a/ui/cli.py +++ b/ui/cli.py @@ -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', }) diff --git a/ui/fixtures/genfixtures.py b/ui/fixtures/genfixtures.py new file mode 100644 index 0000000..7c1fe74 --- /dev/null +++ b/ui/fixtures/genfixtures.py @@ -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' + } +] +)) diff --git a/ui/fixtures/testfiles/test.txt b/ui/fixtures/testfiles/test.txt new file mode 100644 index 0000000..90bfcb5 --- /dev/null +++ b/ui/fixtures/testfiles/test.txt @@ -0,0 +1 @@ +this is a test diff --git a/ui/requirements.txt b/ui/requirements.txt new file mode 100644 index 0000000..9c24470 --- /dev/null +++ b/ui/requirements.txt @@ -0,0 +1,2 @@ +urwid +-e git://github.com/jmgurney/pasn1@27ff594a2609c07205753ce24f74d8f45a7ea418#egg=pasn1