diff --git a/pubs/commands/add_cmd.py b/pubs/commands/add_cmd.py index 6212daa..69861e5 100644 --- a/pubs/commands/add_cmd.py +++ b/pubs/commands/add_cmd.py @@ -1,5 +1,3 @@ -import datetime - from ..uis import get_ui from ..configs import config from .. import bibstruct @@ -86,14 +84,13 @@ def command(args): else: rp.databroker.exists(citekey, both=False) + p = paper.Paper(bibdata, citekey=citekey) + # tags if tags is not None: p.tags = set(tags.split(',')) - p = paper.Paper(bibdata, citekey=citekey) - p.added = datetime.datetime.now() - # document file bib_docfile = bibstruct.extract_docfile(bibdata) diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 32fdac3..3856624 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -341,6 +341,14 @@ class TestUsecase(DataCommandTestCase): with self.assertRaises(SystemExit): self.execute_cmds(cmds) + def test_add_with_tag(self): + cmds = ['pubs init', + 'pubs add data/pagerank.bib --tags junk', + 'pubs tag junk' + ] + outs = self.execute_cmds(cmds) + self.assertEqual(1, len(outs[2].splitlines())) + if __name__ == '__main__': unittest.main()