Skip to content

Commit

Permalink
Add a detailed candidate
Browse files Browse the repository at this point in the history
This change makes a detailed candidate available. This is really important for the detailed report testing
  • Loading branch information
jonodrew committed Aug 9, 2019
1 parent c62370a commit 566eb4f
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ def test_session(db):
Grade(id=2, value='Grade 7', rank=6), Grade(id=3, value='Grade 6', rank=5),
Grade(id=4, value='Deputy Director (SCS1)', rank=4), Grade(id=1, value='Admin Assistant (AA)', rank=7)
])
db.session.add_all([Gender(id=1, value="Fork"), Gender(id=2, value="Knife"), Gender(id=3, value="Chopsticks")])
db.session.add(Candidate(id=1))
db.session.add(Location(id=1, value='Stargate-1'))
db.session.add(WorkingPattern(id=1, value="24/7"))
db.session.add(Belief(id=1, value="Don't forget to be awesome"))
db.session.add(Sexuality(id=1, value="Pan"))
db.session.add(Ethnicity(id=1, value="Terran", bame=True))
db.session.commit()

yield session_
Expand Down Expand Up @@ -89,8 +83,9 @@ def test_candidate(test_session):
candidate.roles.append(
Role(date_started=date(2010, 5, 1), grade_id=2, location_id=1, role_change_id=2))
test_data = {
'grades': [Grade(value='Band A', rank=2), Grade(value='SCS3', rank=1)],
'grades': [Grade(id=10, value='Band A', rank=2), Grade(id=11, value='SCS3', rank=1)],
'test_candidates': [candidate],
'locations': [Location(id=1, value="Test")]
}
for key in test_data.keys():
test_session.add_all(test_data.get(key))
Expand Down Expand Up @@ -213,6 +208,41 @@ def _add_scheme(candidates_to_add, scheme_id_to_add=1, meta=False, delta=False):
return _add_scheme


@pytest.fixture
def detailed_candidate(test_candidate, test_session):
test_candidate: Candidate
test_session.add(Organisation(id=1, name="Department of Fun"))
test_session.add(Location(id=2, value='Stargate-1'))
test_session.add(WorkingPattern(id=1, value="24/7"))
test_session.add(Belief(id=1, value="Don't forget to be awesome"))
test_session.add(Sexuality(id=1, value="Pan"))
test_session.add(Ethnicity(id=1, value="Terran", bame=True))
test_session.add_all([Gender(id=1, value="Fork"), Gender(id=2, value="Knife"),
Gender(id=3, value="Chopsticks")])
test_session.add(Grade(id=5, value="Director (SCS2)", rank=3))
test_session.add(MainJobType(id=1, value="Roboticist", lower_socio_economic_background=True))
test_session.add(AgeRange(id=1, value="Immortal"))

test_candidate.joining_date = date(2018, 9, 1)
test_candidate.joining_grade_id = 1
test_candidate.main_job_type_id = 1
test_candidate.working_pattern_id = 1
test_candidate.belief_id = 1
test_candidate.age_range_id = 1
test_candidate.caring_responsibility = True
test_candidate.long_term_health_condition = True

test_candidate.applications.append(Application(
application_date=date(2018, 6, 1), scheme_start_date=date(2019, 3, 1), meta=True, delta=False, cohort=1,
scheme_id=1
))
test_candidate.roles.extend([
Role(date_started=date(2018, 6, 1)),
Role(date_started=date(2019, 1, 1), role_change_id=1, role_name="Director of Happiness", grade_id=5,
location_id=2, organisation_id=1)
])


@pytest.fixture
def logged_in_user(test_client):
with test_client:
Expand Down

0 comments on commit 566eb4f

Please sign in to comment.