Skip to content

Commit 73a41bb

Browse files
committed
Summary: Fix problem with three NomCom tests that had a hard-coded id,
which doesn't necessarily work with the way transactions work in MySQL - Legacy-Id: 10190
1 parent fbd3157 commit 73a41bb

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

ietf/nomcom/tests.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_private_index_view(self):
108108
def create_nominees_for_states(self, base_state):
109109
cnominee = Nominee.objects.get(email__person__user__username=COMMUNITY_USER)
110110
position = Position.objects.get(name='APP')
111-
NomineePosition.objects.create(position=position,
111+
nom_pos = NomineePosition.objects.create(position=position,
112112
nominee=cnominee,
113113
state=NomineePositionStateName.objects.get(slug=base_state))
114114
position = Position.objects.get(name='INT')
@@ -119,12 +119,13 @@ def create_nominees_for_states(self, base_state):
119119
NomineePosition.objects.create(position=position,
120120
nominee=cnominee,
121121
state=NomineePositionStateName.objects.get(slug=base_state))
122+
return nom_pos
122123

123124
def test_private_index_post_accept(self):
124-
self.create_nominees_for_states('pending')
125+
nom_pos = self.create_nominees_for_states('pending')
125126
login_testing_unauthorized(self, CHAIR_USER, self.private_index_url)
126127
test_data = {"action": "set_as_accepted",
127-
"selected": [1]}
128+
"selected": [nom_pos.pk]}
128129
r = self.client.post(self.private_index_url, test_data)
129130
self.assertEqual(r.status_code, 200)
130131
q = PyQuery(r.content)
@@ -133,10 +134,10 @@ def test_private_index_post_accept(self):
133134
self.client.logout()
134135

135136
def test_private_index_post_decline(self):
136-
self.create_nominees_for_states('pending')
137+
nom_pos = self.create_nominees_for_states('pending')
137138
login_testing_unauthorized(self, CHAIR_USER, self.private_index_url)
138139
test_data = {"action": "set_as_declined",
139-
"selected": [1]}
140+
"selected": [nom_pos.pk]}
140141
r = self.client.post(self.private_index_url, test_data)
141142
self.assertEqual(r.status_code, 200)
142143
q = PyQuery(r.content)
@@ -145,10 +146,10 @@ def test_private_index_post_decline(self):
145146
self.client.logout()
146147

147148
def test_private_index_post_pending(self):
148-
self.create_nominees_for_states('declined')
149+
nom_pos = self.create_nominees_for_states('declined')
149150
login_testing_unauthorized(self, CHAIR_USER, self.private_index_url)
150151
test_data = {"action": "set_as_pending",
151-
"selected": [1]}
152+
"selected": [nom_pos.pk]}
152153
r = self.client.post(self.private_index_url, test_data)
153154
self.assertEqual(r.status_code, 200)
154155
q = PyQuery(r.content)

0 commit comments

Comments
 (0)