Exemple #1
0
  def test_start_conflicting_drafts(self):
    a_pk = 1
    b_pk = 2

    # a has no apps - rules out conflict over apps
    self.assert_count(GrantApplication.objects.filter(organization_id=a_pk), 0)

    # b has draft; create draft for same cycle for a
    self.assert_count(
      DraftGrantApplication.objects.filter(organization_id=b_pk, grant_cycle_id=2), 1)
    draft = DraftGrantApplication(organization_id=a_pk, grant_cycle_id=2)
    draft.save()

    post_data = {
      'action': 'merge',
      '_selected_action': [1, 2]
    }
    res = self.client.post(self.admin_url, post_data, follow=True)

    self.assertTemplateUsed(res, 'admin/grants/organization/change_list.html')
    self.assert_message(res, r'same grant cycle. Cannot be automatically merged.$', regex=True)