# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os

import pytest

from .test_bot import TestBot


class TestBotSupport(TestBot):

    @pytest.mark.parametrize('url,result', [
        ('https://google.com', ['https://google.com']),
        ('google.com', ['google.com']),
        ('google.com/search?q=instabot', ['google.com/search?q=instabot']),
        ('https://google.com/search?q=instabot', ['https://google.com/search?q=instabot']),
        ('мвд.рф', ['мвд.рф']),
        ('https://мвд.рф', ['https://мвд.рф']),
        ('http://мвд.рф/news/', ['http://мвд.рф/news/']),
        ('hello, google.com/search?q=test and bing.com', ['google.com/search?q=test', 'bing.com']),
    ])
    def test_extract_urls(self, url, result):
        assert self.BOT.extract_urls(url) == result

    def test_check_if_file_exist(self):
        test_file = open('test', 'w')

        assert self.BOT.check_if_file_exists('test')

        test_file.close()
        os.remove('test')

    def test_check_if_file_exist_fail(self):
        assert not self.BOT.check_if_file_exists('test')

@@ -67,16 +67,27 @@
 mport os
+%0Aimport sys
 %0A%0Aimport
@@ -1080,28 +1080,573 @@
 heck_if_file_exists('test')%0A
+%0A    @pytest.mark.parametrize('verbosity,text,result', %5B%0A        (True, 'test', 'test'),%0A        (False, 'test', '')%0A    %5D)%0A    def test_console_print(self, verbosity, text, result):%0A        self.BOT.verbosity = verbosity%0A        try:%0A            from io import StringIO%0A            saved_stdout = sys.stdout%0A            out = StringIO()%0A            sys.stdout = out%0A%0A            self.BOT.console_print(text)%0A%0A            output = out.getvalue().strip()%0A            assert output == result%0A        finally:%0A            sys.stdout = saved_stdout%0A

Add test on console print and verbosity