示例#1
0
 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))),
         ))
示例#2
0
    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),
            ))
示例#3
0
    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)
示例#4
0
    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))
示例#5
0
    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)
示例#6
0
 def test_inequality(self):
     call = Call(sentinel.source, sentinel.destination)
     other_call = Call(sentinel.other_source, sentinel.destination)
     self.assertTrue(call != other_call)