def test_setting_context(self): context.store_config_file = lambda x, y: True context.get_resource = lambda x, y, z: True coll = ApplicationList(MagicMock(), href="test/resource") args = {'--name': 'test'} try: context.set_context(coll, args) except: self.fail('Exception should not have been raised.')
def test_setting_context_only_works_for_application_and_directory_resources(self): context.store_config_file = lambda x, y: True context.get_resource = lambda x, y, z: True app = ApplicationList(MagicMock(), href="test/resource") d = DirectoryList(MagicMock(), href="test/resource") args = {'--name': 'test'} try: context.set_context(app, args) except: self.fail('Exception should not have been raised.') try: context.set_context(d, args) except: self.fail('Exception should not have been raised.') acc = AccountList(MagicMock(), href='test/resource') self.assertRaises(ValueError, context.set_context, acc, args)