Пример #1
0
 def test_list(self):
     Channel._list = MagicMock(
         return_value=[channel_email, channel_telegram])
     ch_list = Channel.list()
     self.assertEqual(len(ch_list), 2)
     self.assertEqual(ch_list[0].type, channel_email['type'])
     self.assertEqual(ch_list[1].type, channel_telegram['type'])
Пример #2
0
def channels_list():
    ch_list = Channel.list()

    username = get_jwt_identity()
    user_ch_list = UserChannel.list_from_username(username)

    out = []
    for ch in ch_list:
        found = False
        for u_ch in user_ch_list:
            if u_ch.channel_name == ch.name:
                found = True
                break
        if not found:
            out.append(ch)

    return ch_list_view(out)
Пример #3
0
def channels_admin_list():
    ch_list = Channel.list()
    return ch_admin_list_view(ch_list)