

def test_add_minimal_event(self):
    host = Host.objects.get(fullname='Test Host')
    response = self.client.post(reverse('event_add'), {
        'host': host.id,
        'tags': [self.test_tag.id],
        'administrator': host.id,
        'invoice_status': 'unknown',
    })
    if (response.status_code == 302):
        url = self['location']
        event_id = int(url.rsplit('/', 1)[1])
        event = Event.objects.get(id=event_id)
        assert (event.host == host), 'New event has wrong host: {} != {}'.format(event.host, host)
        tags = list(event.tags.all())
        assert (tags == [self.test_tag]), 'New event has wrong tags: {} != {}'.format(tags, [self.test_tag])
    else:
        self._check_status_code_and_parse(response, 200)
        assert False, 'expected 302 redirect after post'

dataset/ETHPy150Open swcarpentry/amy/workshops/test/test_event.py TestEventViews.test_add_minimal_event/VarMisuse@84/112 `response`->`self`