TST: Test contents of import, not that the command fails
This commit is contained in:
parent
c1afd26d6f
commit
7ba016e54c
@ -17,6 +17,22 @@ institution = {Stanford InfoLab},
|
||||
}
|
||||
"""
|
||||
|
||||
bibtex_external_alt = """
|
||||
@techreport{Page99,
|
||||
number = {1999-66},
|
||||
month = {November},
|
||||
author = {Lawrence Page and Sergey Brin and Rajeev Motwani and Terry Winograd},
|
||||
note = {Previous number = SIDL-WP-1999-0120},
|
||||
title = {The PageRank Citation Ranking: Bringing Order to the Web.},
|
||||
type = {Technical Report},
|
||||
publisher = {Stanford InfoLab},
|
||||
year = {9999},
|
||||
institution = {Stanford InfoLab},
|
||||
url = {http://ilpubs.stanford.edu:8090/422/},
|
||||
abstract = "This is not a real entry, it is just here to test overwriting fails on import. it must have a different year than the str_fixture bibtex_external0, but must have the same citekey for the test to be valid.",
|
||||
}
|
||||
"""
|
||||
|
||||
bibtex_raw0 = """@techreport{
|
||||
Page99,
|
||||
author = "Page, Lawrence and Brin, Sergey and Motwani, Rajeev and Winograd, Terry",
|
||||
|
@ -884,14 +884,18 @@ class TestUsecase(DataCommandTestCase):
|
||||
self.assertEqual(1 + 1, len(outs[-1].split('\n')))
|
||||
|
||||
def test_import_does_not_overwrite(self):
|
||||
with FakeFileOpen(self.fs)('data/real.bib', 'w') as f:
|
||||
f.write(str_fixtures.bibtex_external0)
|
||||
with FakeFileOpen(self.fs)('data/fake.bib', 'w') as f:
|
||||
f.write(str_fixtures.bibtex_external_alt)
|
||||
cmds = ['pubs init',
|
||||
'pubs import data/ Page99',
|
||||
'pubs import data/',
|
||||
'pubs import data/real.bib Page99',
|
||||
'pubs import data/fake.bib Page99',
|
||||
'pubs list'
|
||||
]
|
||||
outs = self.execute_cmds(cmds)
|
||||
self.assertEqual("(1999)", outs[-1][-8:].strip())
|
||||
|
||||
with self.assertRaises(FakeSystemExit):
|
||||
self.execute_cmds(cmds)
|
||||
|
||||
def test_import_overwrites(self):
|
||||
cmds = ['pubs init',
|
||||
|
Loading…
x
Reference in New Issue
Block a user