Exemple #1
0
    def test_upload_img_and_push_msg(self):
        if TEST_TOKEN:
            os.system("wget https://avatars0.githubusercontent.com/u/14851244 -O logo.png")
            media_id = qyweixin.upload(TEST_TOKEN, "logo.png", "logo.png", "image")

            push_msg = qyweixin.WeixinPush()
            result = push_msg.push_image_msg(TEST_TOKEN, agentid=0, media_id=media_id)

            assert media_id is not False
            assert result is True

            os.system("rm logo.png")
Exemple #2
0
    def test_upload_file_and_push_msg(self):
        if TEST_TOKEN:
            os.system('echo "test upload file for qyweixin" > test_qyweixin.txt')
            media_id = qyweixin.upload(TEST_TOKEN, "test_qyweixin.txt", "test_qyweixin.txt", "file")

            push_msg = qyweixin.WeixinPush()
            result = push_msg.push_file_msg(TEST_TOKEN, agentid=0, media_id=media_id)

            assert media_id is not False
            assert result is True

            os.system("rm test_qyweixin.txt")
Exemple #3
0
    def test_upload_file_and_push_msg(self):
        if TEST_TOKEN:
            os.system(
                'echo "test upload file for qyweixin" > test_qyweixin.txt')
            media_id = qyweixin.upload(TEST_TOKEN, 'test_qyweixin.txt',
                                       'test_qyweixin.txt', 'file')

            push_msg = qyweixin.WeixinPush()
            result = push_msg.push_file_msg(TEST_TOKEN,
                                            agentid=0,
                                            media_id=media_id)

            assert media_id is not False
            assert result is True

            os.system('rm test_qyweixin.txt')
Exemple #4
0
    def test_upload_img_and_push_msg(self):
        if TEST_TOKEN:
            os.system(
                'wget https://avatars0.githubusercontent.com/u/14851244 -O logo.png'
            )
            media_id = qyweixin.upload(TEST_TOKEN, 'logo.png', 'logo.png',
                                       'image')

            push_msg = qyweixin.WeixinPush()
            result = push_msg.push_image_msg(TEST_TOKEN,
                                             agentid=0,
                                             media_id=media_id)

            assert media_id is not False
            assert result is True

            os.system('rm logo.png')