我正在创建一个测试脚本,我想确保修改数据。
def test_mission_if_collabor_and_user_are_the_same(self):
""" If the user is also written as the collaborator,
Mission should not duplicate"""
#Check length of missions return 2
actuser = ActuserViewModel(self.user_name[0], 'M')
actuser.get_mission_list(self.user_name[0])
#Check if it shows the mission list
self.assertEqual(len(actuser.missionList), 2)
#update one of the missions where collaborator is the same as the user
# Call view by POST method
mission = MissionViewModel(self.mission_id_list[0])
missionForm = MissionForm(data={'name': 'test name','collaborator':'useraaaa'}, instance=mission.db)
mission.save_to_actinbox()
#save updated test
missionCheck = MissionViewModel(self.mission_id_list[0])
self.assertEqual(missionCheck.db.collaborator, 2)
我对这部分编码没有信心,systax可能不正确,因为它没有显示数据已更新
missionForm = MissionForm(data={'name': 'test name','collaborator':'useraaaa'}, instance=mission.db)