def t12(HOME): pretty = '%s t12' % __file__ print(pretty) path = os.path.join(HOME.path, '.ave', 'config', 'workspace.json') with open(path, 'w') as f: json.dump({ 'root': '~', 'tools': { 'ls': '/bin/ls' }, 'flocker': FLOCKER }, f) config = Workspace.load_config(path, home=HOME.path) try: profile = WorkspaceProfile(config) except Exception, e: print('FAIL %s: could not create profile: %s' % (pretty, str(e))) return False
def t13(HOME): pretty = '%s t13' % __file__ print(pretty) path = os.path.join(HOME.path, '.ave', 'config', 'workspace.json') with open(path, 'w') as f: json.dump({ 'root': '~', 'tools': { 'ls': '/bin/ls' }, 'flocker': FLOCKER }, f) config = Workspace.load_config(path, HOME.path) profile = WorkspaceProfile(config) if not profile.match({'type': 'workspace'}): print('FAIL %s: generic match failed' % pretty) return False if not profile.match({'type': 'workspace', 'tools': ['ls']}): print('FAIL %s: tools match failed' % pretty) return False workspace = Workspace('foobar', home=HOME.path) if not workspace.get_profile().match(profile): print('FAIL %s: non-uid match failed: %s' % (pretty, profile)) return False if not workspace.get_profile().match({ 'type': 'workspace', 'uid': 'foobar' }): print('FAIL %s: uid match failed: %s' % pretty) return False return True