def test_equality(self): assert_that( Call(sentinel.source, sentinel.destination), all_of( equal_to(Call(sentinel.source, sentinel.destination)), is_not( equal_to(Call(sentinel.other_source, sentinel.destination))), is_not( equal_to(Call(sentinel.source, sentinel.other_destination))), is_not( equal_to( Call(sentinel.other_source, sentinel.other_destination))), ))
def test_call_simple_attributes(self): call = Call(sentinel.source, sentinel.destination) assert_that( call, all_of( has_property('source', sentinel.source), has_property('destination', sentinel.destination), ))
def test_when_hangup_then_hangup_destination(self): call = Call( _Channel(sentinel.source_exten, sentinel.source_channel), _Channel(sentinel.destination_exten, sentinel.destination_channel), ) self.manager.hangup(call) self._ami.hangup.assert_called_once_with(sentinel.source_channel)
def _internal_helper(self, source_internal, destination_internal, expected): source = _Channel(Mock(Call, is_internal=source_internal), sentinel.channel_name) destination = _Channel(Mock(Call, is_internal=destination_internal), sentinel.channel_name) call = Call(source, destination) assert_that(call.is_internal, equal_to(expected))
def new_call(self, uniqueid, destination_uniqueid, source, destination): self.end_call(uniqueid) self.end_call(destination_uniqueid) self._calls[uniqueid] = Call(source, destination) event = CallEvent(uniqueid=uniqueid, source=source.extension, destination=destination.extension, status=CallStatus.ringing) self._call_notifier.notify(event)
def test_inequality(self): call = Call(sentinel.source, sentinel.destination) other_call = Call(sentinel.other_source, sentinel.destination) self.assertTrue(call != other_call)