def test_changing_name_updates_save_file(self): # Given save_file = join(self.root, 'test_save.vxn') p = Project(name='test', path=self.root, save_file=save_file) p.scan() p.save() # When p.name = 'new name' # Then new_save_file = join(self.root, 'new_name.vxn') self.assertEqual(p.save_file, new_save_file) self.assertTrue(exists(p.save_file))
def test_load(self): # Given vixen = Vixen() # When vixen.load() # Then self.assertEqual(len(vixen.projects), 1) self.assertEqual(vixen.projects[0].name, '__hidden__') # When p = Project( name='test', path=self.root, description='desc', extensions=['.py', '.txt'] ) p.scan() p.save() vixen.add(p) # Then self.assertEqual(len(vixen.projects), 1) self.assertEqual(vixen.projects[0].name, 'test') # Given vixen.save() vixen = Vixen() vixen.load() # Then self.assertEqual(len(vixen.projects), 1) p = vixen.projects[0] self.assertEqual(p.name, 'test') self.assertEqual(p.number_of_files, 0) # When p.load() # Then self.assertEqual(p.number_of_files, 5) m = p.get('root.txt') self.assertEqual(m.relpath, 'root.txt') self.assertEqual(m.type, 'text') self.assertEqual(len(m.tags), 1)