Esempio n. 1
0
def test_update_class():
    name = "withattrs"
    desc = "should now have attrs"
    attrs = [{'name': "testattr", 'scope': "public", 'attr_type': "string",
              'description': "this is a test attr"}]
    models.new_class(name, desc, p.id, attributes=attrs, id=c.id)
    assert c.attributes is not [] and c.description == desc
Esempio n. 2
0
def test_create_child():
    name = "childclass"
    desc = "should be child of class c"
    d = models.db.query(models.Class).filter(models.Class.id ==
                                             models.new_class(name, desc,
                                                              p.id)).first()
    models.add_child(d.id, c.name)
    assert d in c.children and c in d.parents
Esempio n. 3
0
def new_class(json_obj):
    name = json_obj["name"]
    project_id = json_obj["project_id"]
    if "abstract" not in json_obj:
        abstract = None
    else:
        abstract = json_obj["abstract"]
    description = json_obj["description"]
    if "id" not in json_obj:
        cid = None
        attributes = None
    else:
        cid = json_obj["id"]
        attributes = json_obj["attributes"]
    return models.new_class(name, description, project_id, abstract,
                            attributes, cid)
Esempio n. 4
0
def test_create_class():
    name = "testclass"
    desc = "this is a test class"
    n = models.new_class(name, desc, p.id)
    assert n is not None
Esempio n. 5
0
import class_models as models
import nose

models.test_session()

p = models.new_project("testproj", "testdesc")  # test project
cid = models.new_class("testc", "testdesc", p.id)  # test class
c = models.db.query(models.Class).filter(models.Class.id == cid).first()


def test_create_project():
    name = "test"
    desc = "this is a test"
    p = models.new_project(name, desc)
    assert p.description == desc and p.name == name and p.id is not None


def test_update_project():
    newname = "newtest"
    newdesc = "this is a new description"
    n = models.new_project(newname, newdesc, p.id)
    assert n.description == newdesc and n.name == newname and n.id is not None


def test_create_class():
    name = "testclass"
    desc = "this is a test class"
    n = models.new_class(name, desc, p.id)
    assert n is not None