def test_ConversationView_add_reply():
    """
    Adding a reply results in a new ReplyWidget added to the layout.
    """
    cv = ConversationView(None)
    cv.controller = mock.MagicMock()
    cv.conversation_layout = mock.MagicMock()
    cv.add_reply('hello')
    assert cv.conversation_layout.addWidget.call_count == 1
    cal = cv.conversation_layout.addWidget.call_args_list
    assert isinstance(cal[0][0][0], ReplyWidget)
Exemple #2
0
def test_ConversationView_add_reply():
    """
    Adding a reply results in a new ReplyWidget added to the layout. Any
    associated files are added as FileWidgets.
    """
    cv = ConversationView(None)
    cv.conversation_layout = mock.MagicMock()
    cv.add_reply('hello', [
        'file1.pdf',
    ])
    assert cv.conversation_layout.addWidget.call_count == 2
    cal = cv.conversation_layout.addWidget.call_args_list
    assert isinstance(cal[0][0][0], ReplyWidget)
    assert isinstance(cal[1][0][0], FileWidget)
Exemple #3
0
 def show_conversation_for(self, source):
     """
     TODO: Finish this...
     """
     conversation = ConversationView(self)
     conversation.add_message('Source name: {}'.format(
         source.journalist_designation))
     conversation.add_message('Hello, hello, is this thing switched on?')
     conversation.add_reply('Yes, I can hear you loud and clear!')
     conversation.add_reply('How can I help?')
     conversation.add_message('I have top secret documents relating to '
                              'a massive technical scandal at the heart '
                              ' of the Freedom of the Press Foundation. '
                              'In a shocking turn of events, it appears '
                              'they give away all their software for FREE.')
     conversation.add_message("Hello: I’m a nurse at one of the trauma "
                              "centers in town. We've had many patients in "
                              "the last several months, all with "
                              "similar/mysterious respiratory issues. My "
                              "staff has noticed that most live down-wind "
                              "from the Dole fields West of 696. Some of "
                              "the patients say they have complained to "
                              "local authorities about sewage smells. One "
                              "said she's spotted a truck spraying a "
                              "sludge of some kind, on the fields at "
                              "night. I'm attaching a video from the "
                              "patient who taped the trucks, and a PDF of "
                              "redacted police reports that other patients "
                              "shared. I don’t know if there's much you "
                              "can do, but if there is I would be happy "
                              "to help.")
     conversation.add_message(
         "I work at the City Water Department, and a "
         "man named Reggie Esters is one of our board "
         "directors. I believe Reggie is related to "
         "Rep Monica Conyers. He's literally never "
         "here, and the resume on file for him makes "
         "no sense. I have a hunch he is not in his "
         "job legitimately, and think you should look "
         "into this. Also: someone I work with heard "
         "him on the phone once, talking about his "
         "'time' at Jackson—that contradicts his "
         "resume. It really seems fishy.", [
             'fishy_cv.PDF (234Kb)',
         ])
     conversation.add_reply(
         "THIS IS IT THIS IS THE TAPE EVERYONE'S "
         "LOOKING FOR!!!", [
             'filename.pdf (32Kb)',
         ])
     conversation.add_reply("Hello: I read your story on Sally Dale, and "
                            "her lawsuit against the St. Joseph's "
                            "Orphanage. My great-aunt was one of the nuns "
                            "there. She is willing to be interviewed, but "
                            "does not want her name, location, or any "
                            "identity details released. She feels "
                            "horrible. She wants the children who survived "
                            "to find peace. Thanks.")
     self.main_view.update_view(conversation)
Exemple #4
0
def test_ConversationView_add_reply(mocker, homedir):
    """
    Adding a reply results in a new ReplyWidget added to the layout.
    """
    mocked_source = mocker.MagicMock()
    mocked_controller = mocker.MagicMock()

    cv = ConversationView(mocked_source, homedir, mocked_controller)
    cv.conversation_layout = mocker.MagicMock()

    cv.add_reply('mock id', 'hello')
    assert cv.conversation_layout.addWidget.call_count == 1

    cal = cv.conversation_layout.addWidget.call_args_list
    assert isinstance(cal[0][0][0], ReplyWidget)