Esempio n. 1
0
def test_select_channels_2():
    # Test to avoid adding to users registered channels if channel already exist in users registered channels

    original_user = user_control.User
    user_control.User = mock.Mock()
    mocked_ob = user_control.User
    channel_list = ["Twitter"]
    mocked_ob.registered_channels = ["Twitter"]
    application_control.select_channels(channel_list, mocked_ob)
    mocked_ob.add_channel.assert_not_called()
    assert application_control.selected_channels == channel_list
    user_control.User = original_user
Esempio n. 2
0
def test_select_channels_1():
    # Test to add channel to users registered channels if channel does not exist in users registered channels

    original_user = user_control.User
    user_control.User = mock.Mock()
    mocked_ob = user_control.User
    channel_list = ["mail"]
    mocked_ob.registered_channels = ["Twitter"]
    application_control.select_channels(channel_list, mocked_ob)
    mocked_ob.add_channel.assert_called_with("mail")
    assert application_control.selected_channels == channel_list
    user_control.User = original_user