Exemplo n.º 1
0
def fixtures(session):
    """
    Dependency Graph:

    (library) <-[:DEPENDS_ON]- (app)

    Impact Graph:

    (library) -[:IMPACTS]-> (app)

    Test Suites:

    Unit: test a standalone project

        - library
        - app

    Integration: test a project against the things it depends upon

        - app: test app against library
    """

    # need to make sure main conftest is run before importing the cinch module,
    # since it sets the db uri based on pytest args
    from cinch.models import Project
    from cinch.jenkins.models import Job

    # projects
    library = Project(name="library", owner='owner')
    app = Project(name="app", owner='owner')

    # unit jobs
    library_unit = Job(name="library_unit", projects=[library])
    app_unit = Job(name="app_unit", projects=[app])

    # integration jobs
    app_integration = Job(name="app_integration", projects=[app, library])

    session.add(library)
    session.add(app)

    session.add(library_unit)
    session.add(app_unit)

    session.add(app_integration)

    created = {obj.name: obj for obj in session.new}
    session.commit()

    return created
Exemplo n.º 2
0
def test_check_no_jobs(session, app_context):
    project = Project(name='foo', owner='bar')
    session.add(project)
    session.commit()

    assert build_check(session, 'foo', 'sha') is True
Exemplo n.º 3
0
 def project(self, session):
     project = Project(owner='my_owner', name='my_name')
     session.add(project)
     session.commit()
     return project
Exemplo n.º 4
0
 def project(self, session):
     project = Project(owner='my_owner', name='my_name', update_status=True)
     session.add(project)
     session.commit()
     return project