def test_get_domains():
    moga = Admin(TRACKERS)
    try:
        moga.create_domain(DOMAIN)
        moga.create_class(DOMAIN, CLASS, 2)
        ret = moga.get_domains()
        assert DOMAIN in ret
        assert CLASS in ret[DOMAIN], ret
        assert ret[DOMAIN][CLASS] == 2, ret
    finally:
        moga.delete_domain(DOMAIN)
def test_create_domain():
    moga = Admin(TRACKERS)

    moga.delete_domain(DOMAIN)
    moga.create_domain(DOMAIN)

    try:
        moga.create_domain(DOMAIN)
    except MogileFSError:
        # domain exists
        pass
    else:
        assert False, "the domain %s should exist" % DOMAIN
    assert moga.delete_domain(DOMAIN)
def test_delete_domain():
    moga = Admin(TRACKERS)
    try:
        moga.delete_domain(DOMAIN)
    except MogileFSError:
        # domain does not exist
        pass
    else:
        assert False, "the domain %s should not exist" % DOMAIN
    assert moga.create_domain(DOMAIN)
    assert moga.delete_domain(DOMAIN)
def test_create_class():
    moga = Admin(TRACKERS)
    moga.create_domain(DOMAIN)
    moga.create_class(DOMAIN, CLASS, 2)
    moga.delete_class(DOMAIN, CLASS)