def test_url_api_builder_live_streams_by_cat(self):
     url = "https://test.com:5609?username=test&password=pass"
     matched, conn = Connection.from_url(url)
     cat = 69
     url = Url_api_builder.build(EndpointEnum.LIVE_STREAMS_BY_CATEGORY,
                                 conn, cat)
     expected = f"https://test.com:5609/player_api.php?username=test&password=pass&action=get_live_streams&category_id={cat}"
     self.assertEqual(expected, url)
 def test_url_api_builder_auth(self):
     url = "https://test.com:5609?username=test&password=pass"
     matched, conn = Connection.from_url(url)
     url = Url_api_builder.build(EndpointEnum.AUTH, conn)
     expected = "https://test.com:5609/player_api.php?username=test&password=pass"
     self.assertEqual(expected, url)
 def test_url_api_builder_live_streams(self):
     url = "https://test.com:5609?username=test&password=pass"
     matched, conn = Connection.from_url(url)
     url = Url_api_builder.build(EndpointEnum.LIVE_STREAMS, conn)
     expected = f"https://test.com:5609/player_api.php?username=test&password=pass&action=get_live_streams"
     self.assertEqual(expected, url)
 def test_matched_url(self):
     url = "https://test.com:5609?username=test&password=pass"
     matched, conn = Connection.from_url(url)
     self.assertTrue(matched)
     self.assertTrue(isinstance(conn, Connection))
     self.assertEqual(str(conn), url)
 def test_not_matched_username_url(self):
     url = "https://test.com:5609?usename=test&password=pass"
     matched, conn = Connection.from_url(url)
     self.assertFalse(matched)
Beispiel #6
0
 def __init__(self, url: str):
     self._url = url
     self.matched, self._connection = Connection.from_url(url)