示例#1
0
 def test_create_project(self):
     write_domain_data()
     session = connection.get_session()
     project_api = ProjectApi(session)
     projects = get_project_data()
     for project in projects:
         project = project.to_dict()
         project_api.create_project(project)
     refs = project_api.list_projects()
     assert len(refs) == 4
     assert refs[0].get("id") == "1"
示例#2
0
 def test_create_project_conflict(self):
     write_domain_data()
     session = connection.get_session()
     project_api = ProjectApi(session)
     projects = get_project_data()
     for project in projects:
         project = project.to_dict()
         project_api.create_project(project)
     try:
         project_api.create_project(projects[0].to_dict())
     except Exception as e:
         assert isinstance(e, exception.Conflict)