def test_ceap_datasets(self, mock_urlretrieve):
# backup existing file if exists
original = path.join(settings.CORE_STATIC_DIR, 'ceap-datasets.html')
backup = original + '.bkp'
if path.exists(original):
rename(original, backup)
# test
self.assertEqual(None, finders.find('ceap-datasets.html'))
call_command('ceapdatasets', stdout=StringIO())
self.assertTrue(finders.find('ceap-datasets.html'))
# restore existing file backup
if path.exists(backup):
remove(backup, original)
评论列表
文章目录