mirror of https://github.com/streamlink/streamlink
[chaturbate] Fixed python 3.5 bug and added regex tests
This commit is contained in:
parent
dc95ccf7cf
commit
277d064051
|
@ -28,7 +28,7 @@ class Chaturbate(Plugin):
|
|||
match = _url_re.match(self.url)
|
||||
username = match.group("username")
|
||||
|
||||
CSRFToken = str(uuid.uuid4().get_hex().upper()[0:32])
|
||||
CSRFToken = str(uuid.uuid4().hex.upper()[0:32])
|
||||
|
||||
headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import unittest
|
||||
|
||||
from streamlink.plugins.chaturbate import Chaturbate
|
||||
|
||||
|
||||
class TestPluginChaturbate(unittest.TestCase):
|
||||
def test_can_handle_url(self):
|
||||
# should match
|
||||
self.assertTrue(Chaturbate.can_handle_url("https://chaturbate.com/username"))
|
||||
self.assertTrue(Chaturbate.can_handle_url("https://m.chaturbate.com/username"))
|
||||
self.assertTrue(Chaturbate.can_handle_url("https://www.chaturbate.com/username"))
|
||||
|
||||
# shouldn't match
|
||||
self.assertFalse(Chaturbate.can_handle_url("http://local.local/"))
|
||||
self.assertFalse(Chaturbate.can_handle_url("http://localhost.localhost/"))
|
Loading…
Reference in New Issue