

def test_set_suggestion(self):
    actions = [{
        'action': consts.SET,
        'subject': self.member1,
        'fields': {
            'website': self.MK_SITE,
            'gender': GENDER_CHOICES[0][0],
            'current_party': self.party,
        },
    }]
    suggestion = Suggestion.objects.create_suggestion(suggested_by=self.regular_user, actions=actions)
    self.assertIsNone(self.member1.website)
    self.assertIsNone(self.member1.gender)
    self.assertIsNone(self.member1.current_party)
    suggestion.auto_apply(self.editor)
    mk = Member.objects.get(pk=self.member1.pk)
    self.assertEqual(mk.website, self.MK_SITE)
    self.assertEqual(mk.gender, GENDER_CHOICES[0][0])
    self.assertEqual(mk.current_party, self.party)
    suggestion = Suggestion.objects.get(pk=suggestion.pk)
    self.assertEqual(suggestion.resolved_status, consts.FIXED)
    self.assertEqual(suggestion.resolved_by, self.editor)
    self.assertIsNotNone(suggestion.resolved_at)
    mk.website = None
    mk.gender = None
    mk.current_party = None
    suggestion.save()
    self.member1 = mk
    Suggestion.objects.all().delete()

dataset/ETHPy150Open ofri/Open-Knesset/suggestions/tests.py SuggestionsTests.test_set_suggestion/VarMisuse@253/334 `mk`->`suggestion`