def test_basic_user_foo(): """ Test that user routines works """ u = User(_id='joe', name='Joe Bar', gpg="8F049AD82C92066C7352D28A7B585B30807C2A87", email="*****@*****.**") assert 'joe' == u.save() u.save() joe = User.get_by_email('*****@*****.**') joe.pop('updated_at') u.pop('updated_at') assert joe == u joe = User.get_by_key("8F049AD82C92066C7352D28A7B585B30807C2A87") joe.pop('updated_at') assert joe == u try: joe = User.get_by_key("foo") assert True is False, "KeyCheck failed" except KeyError: pass
def main(): if not args.files: raise Exception("WTF - need a config") config = args.files.pop(0) obj = json.load(open(config, 'r')) machines = obj['machines'] configs = obj['configs'] users = obj['users'] puts("Loading users:") for conf in progress.bar(users): u = User(**conf) u.save() puts("Loading machines:") for conf in progress.bar(machines): m = Machine(**conf) m.save() puts("Loading configs:") for conf in progress.bar(configs): c = Config(**conf) c.save()