def test_get_save_refs_dont_mutate_app(self):
     case_refs = CaseReferences(
         load={}, save={'p1': CaseSaveReference(properties=['p1', 'p2'])})
     save_ref = next(case_refs.get_save_references())
     save_ref.properties.append('p3')
     self.assertEqual(['p1', 'p2', 'p3'], save_ref.properties)
     self.assertEqual(['p1', 'p2'], case_refs.save['p1'].properties)
 def test_get_save_refs_dont_mutate_app(self):
     case_refs = CaseReferences(load={}, save={
         'p1': CaseSaveReference(properties=['p1', 'p2'])
     })
     save_ref = next(case_refs.get_save_references())
     save_ref.properties.append('p3')
     self.assertEqual(['p1', 'p2', 'p3'], save_ref.properties)
     self.assertEqual(['p1', 'p2'], case_refs.save['p1'].properties)
 def test_get_save_refs(self):
     save = {
         'path1': CaseSaveReference(case_type='foo', properties=['p1', 'p2']),
         'path2': CaseSaveReference(properties=['p3'], create=True, close=True),
     }
     case_refs = CaseReferences(
         save=save,
     )
     save_refs = list(case_refs.get_save_references())
     self.assertEqual(2, len(save_refs))
     for save_ref in save_refs:
         orig_ref = save[save_ref.path]
         for attr in ('case_type', 'properties', 'create', 'close'):
             self.assertEqual(getattr(orig_ref, attr), getattr(save_ref, attr))
示例#4
0
 def test_get_save_refs(self):
     save = {
         'path1': CaseSaveReference(case_type='foo', properties=['p1', 'p2']),
         'path2': CaseSaveReference(properties=['p3'], create=True, close=True),
     }
     case_refs = CaseReferences(
         save=save,
     )
     save_refs = list(case_refs.get_save_references())
     self.assertEqual(2, len(save_refs))
     for save_ref in save_refs:
         orig_ref = save[save_ref.path]
         for attr in ('case_type', 'properties', 'create', 'close'):
             self.assertEqual(getattr(orig_ref, attr), getattr(save_ref, attr))