def test_port(self):
     url1 = "http://google.com|801/"
     url2 = "http://801:google.com/"
     url3 = "http://google.com:801/"
     self.assertFalse(is_valid_url(url1))
     self.assertFalse(is_valid_url(url2))
     self.assertTrue(is_valid_url(url3))
 def test_port(self):
     url1 = "http://google.com|801/"
     url2 = "http://801:google.com/"
     url3 = "http://google.com:801/"
     self.assertFalse(is_valid_url(url1))
     self.assertFalse(is_valid_url(url2))
     self.assertTrue(is_valid_url(url3))
 def test_hostname(self):
     url1 = "http://wwwgooglecom"
     url2 = "http://googlecom"
     url3 = "http://google.com"
     url4 = "http://google.com`"
     self.assertFalse(is_valid_url(url1))
     self.assertFalse(is_valid_url(url2))
     self.assertTrue(is_valid_url(url3))
     self.assertFalse(is_valid_url(url4))
 def test_hostname(self):
     url1 = "http://wwwgooglecom"
     url2 = "http://googlecom"
     url3 = "http://google.com"
     url4 = "http://google.com`"
     self.assertFalse(is_valid_url(url1))
     self.assertFalse(is_valid_url(url2))
     self.assertTrue(is_valid_url(url3))
     self.assertFalse(is_valid_url(url4))
 def test_schemes(self):
     url1 = "http://www.google.com"
     url2 = "https://www.google.com"
     url3 = "ftp://www.google.com"
     url4 = "sftp://www.google.com"
     url5 = "ssh://www.google.com"
     url6 = "://www.google.com"
     self.assertTrue(is_valid_url(url1))
     self.assertTrue(is_valid_url(url2))
     self.assertTrue(is_valid_url(url3))
     self.assertFalse(is_valid_url(url4))
     self.assertFalse(is_valid_url(url5))
     self.assertFalse(is_valid_url(url6))
 def test_schemes(self):
     url1 = "http://www.google.com"
     url2 = "https://www.google.com"
     url3 = "ftp://www.google.com"
     url4 = "sftp://www.google.com"
     url5 = "ssh://www.google.com"
     url6 = "://www.google.com"
     self.assertTrue(is_valid_url(url1))
     self.assertTrue(is_valid_url(url2))
     self.assertTrue(is_valid_url(url3))
     self.assertFalse(is_valid_url(url4))
     self.assertFalse(is_valid_url(url5))
     self.assertFalse(is_valid_url(url6))
 def test_ucHostname(self):
     url = "http://wWW.gOOGLe.CoM/"
     can = "http://www.google.com/"
     self.assertTrue(is_valid_url(url))
     self.assertEqual(normalize_url(url), can)
 def test_ucScheme(self):
     url = "HtTp://www.google.com/"
     can = "http://www.google.com/"
     self.assertTrue(is_valid_url(url))
     self.assertEqual(normalize_url(url), can)
 def test_percEncodedChars(self):
     # valid
     url1 = "http://google.com/%20/"
     url2 = "http://google.com/%21/"
     url3 = "http://google.com/%99/"
     url4 = "http://google.com/%9F/"
     url5 = "http://google.com/%A0/"
     url6 = "http://google.com/%FE/"
     url7 = "http://google.com/%FF/"
     #invalid
     url8 = "http://google.com/%19/"
     url9 = "http://google.com/%2/"
     url10 = "http://google.com/%09/"
     url11 = "http://google.com/%FG/"
     url12 = "http://google.com/%2G/"
     
     self.assertTrue(is_valid_url(url1))
     self.assertTrue(is_valid_url(url2))
     self.assertTrue(is_valid_url(url3))
     self.assertTrue(is_valid_url(url4))
     self.assertTrue(is_valid_url(url5))
     self.assertTrue(is_valid_url(url6))
     self.assertTrue(is_valid_url(url7))
     self.assertFalse(is_valid_url(url8))
     self.assertFalse(is_valid_url(url9))
     self.assertFalse(is_valid_url(url10))
     self.assertFalse(is_valid_url(url11))
     self.assertFalse(is_valid_url(url12))
예제 #10
0
        with open("app/README.md") as readme:
            markdown = Markdown(readme.read())
        console.print(markdown)
        print("\n")
        time.sleep(1)
        continue


    if(choice =="2"):
        print("[bold blue]\nGetting Submission Prompt Ready...[/]")
        time.sleep(1)
        
        while(True):
            try:
                webhook_url = console.input("\n[#5499C7]Input a Webhook URL to get Started: [/]")
                if not is_valid_url(webhook_url):
                    raise ValueError("Please provide a valid url, in the form of a protocol (https), hostname (site.com), and arguments (.../example)")  
            except ValueError as e:
                print("[red]"+str(e)+"[/]")
                continue
            
            if not "discord" in webhook_url:
                print("[red]"+"Please provide a Discord Webhook URL"+"[/]")
                continue
            
            
            webhook = DiscordWebhook(url=webhook_url, content="Here are the lyrics to your song!", \
                username="******", avatar_url="https://i.pinimg.com/originals/69/96/5c/69965c2849ec9b7148a5547ce6714735.jpg")
            
            while(True):
            
 def test_ucHostname(self):
     url = "http://wWW.gOOGLe.CoM/"
     can = "http://www.google.com/"
     self.assertTrue(is_valid_url(url))
     self.assertEqual(normalize_url(url), can)
 def test_ucScheme(self):
     url = "HtTp://www.google.com/"
     can = "http://www.google.com/"
     self.assertTrue(is_valid_url(url))
     self.assertEqual(normalize_url(url), can)
    def test_percEncodedChars(self):
        # valid
        url1 = "http://google.com/%20/"
        url2 = "http://google.com/%21/"
        url3 = "http://google.com/%99/"
        url4 = "http://google.com/%9F/"
        url5 = "http://google.com/%A0/"
        url6 = "http://google.com/%FE/"
        url7 = "http://google.com/%FF/"
        #invalid
        url8 = "http://google.com/%19/"
        url9 = "http://google.com/%2/"
        url10 = "http://google.com/%09/"
        url11 = "http://google.com/%FG/"
        url12 = "http://google.com/%2G/"

        self.assertTrue(is_valid_url(url1))
        self.assertTrue(is_valid_url(url2))
        self.assertTrue(is_valid_url(url3))
        self.assertTrue(is_valid_url(url4))
        self.assertTrue(is_valid_url(url5))
        self.assertTrue(is_valid_url(url6))
        self.assertTrue(is_valid_url(url7))
        self.assertFalse(is_valid_url(url8))
        self.assertFalse(is_valid_url(url9))
        self.assertFalse(is_valid_url(url10))
        self.assertFalse(is_valid_url(url11))
        self.assertFalse(is_valid_url(url12))