def test__batchy_update__add_key(self): files = _list_files(dirs=['files/people']) batchy_update('thing', 'TEST', files, add=True) docs = _read_files(TESTFILES) for doc in docs: if doc[RESERVED_FILE_KEY] in TESTFILES_PEOPLE: self.assertTrue('thing' in doc.keys()) self.assertEqual(doc['thing'], 'TEST') else: self.assertFalse('thing' in doc.keys())
def test__utils__list_files__given_files_and_dirs(self): focus = ['files/people/bob.yml', 'files/people/jeff.yml'] output = _list_files(files=focus, dirs=['files/animals']) output.sort() files = focus + TESTFILES_ANIMALS files.sort() print TESTFILES_ANIMALS print files print output self.assertEqual(files, output)
def test__utils__list_files__given_dirs(self): files = _list_files(dirs=['files/people']) files.sort() self.assertEqual(files, TESTFILES_PEOPLE)
def test__utils__list_files__given_files(self): focus = ['files/people/bob.yml', 'files/people/jeff.yml'] files = _list_files(files=focus) files.sort() self.assertEqual(files, focus)
def test__utils__list_files__empty_lists(self): files = _list_files() files.sort() self.assertEqual(files, TESTFILES)