def test_response(self): e = EventFactory.Generic(status_code=401, content='{"hello":"there"}') response = e.response() assert isinstance(response, HttpResponse) assert response.status_code == 401 assert response.content == b'{"hello":"there"}'
def test_extend(self): e = EventFactory.Generic(status_code=401, content='{"hello":"there"}') extended = e.extend(method='POST', path='/hi/there') assert extended.method == 'POST' assert extended.path == '/hi/there' assert isinstance(extended, EventFactory.Generic)
def test_log(self): e = EventFactory.Generic(status_code=401, content='{"hello":"there"}') e.logger = Mock() e.extend(method='POST', path='/hi/there').log() assert e.logger.info.call_args_list == ( [call('[POST /hi/there] -> 401')])
def test_init(self): e = EventFactory.Generic(status_code=401, content='{"hello":"there"}') assert e.status_code == 401 assert e.content == '{"hello":"there"}'