예제 #1
0
    def test_determine_server_id(self, init_browser_mock, browser_mock, configuration_mock):
        browser_mock.current_url = 'http://localhost/web/index.html#!/settings/server/ThisIsAMockUUID/general'
        site = Plex(None)
        site.browser = browser_mock
        site.BASE_URL = 'localhost'

        result = site._determine_server_id()  # pylint: disable=protected-access

        self.assertEqual('ThisIsAMockUUID', result)
예제 #2
0
    def test_determine_movie_section_id(self, init_browser_mock, browser_mock, configuration_mock):
        browser_mock.page_source = self.server_sections
        site = Plex(None)
        site.browser = browser_mock
        site.BASE_URL = 'localhost'

        result = site._determine_movies_section_id()  # pylint: disable=protected-access

        self.assertEqual('5', result)
예제 #3
0
class PlexSiteTest(TestCase):
    def setUp(self):
        self.site = Plex(None)

    def test_login(self):
        self.assertIn('signed-in', self.site.browser.page_source)

    def tearDown(self):
        self.site.kill_browser()
예제 #4
0
    def test_insert_login_credentials(self, init_browser_mock, browser_mock,
                                      configuration_mock, base_site_mock):
        browser_mock.current_url = 'http://localhost/web/index.html#!/settings/server/ThisIsAMockUUID/general'
        site = Plex(None)
        site.browser = browser_mock
        site.BASE_URL = 'localhost'

        site._insert_login_credentials()  # pylint: disable=protected-access

        self.assertTrue(base_site_mock.called)
예제 #5
0
    def test_determine_plex_token(self, init_browser_mock, browser_mock,
                                  configuration_mock, regex_mock):
        browser_mock.current_url = 'http://localhost/web/index.html#!/settings/server/ThisIsAMockUUID/general'
        site = Plex(None)
        site.browser = browser_mock
        site.SERVER_ID = 'ThisIsAMockUUID'
        site.BASE_URL = 'localhost'
        regex_mock.return_value = ['ThisIsAMockToken']

        result = site._determine_plex_token()  # pylint: disable=protected-access

        self.assertEqual('ThisIsAMockToken', result)
예제 #6
0
    def test_parse_configuration(self, init_browser_mock, browser_mock,
                                 server_id_mock, plex_token_mock):
        browser_mock.current_url = 'http://localhost/web/index.html#!/settings/server/ThisIsAMockUUID/general'
        site = Plex(None)
        site.browser = browser_mock
        server_id_mock.return_value = 'ThisIsAMockUUID'
        plex_token_mock.return_value = 'ThisIsAMockToken'
        site.BASE_URL = 'localhost'

        site._parse_configuration()  # pylint: disable=protected-access

        self.assertTrue(server_id_mock.called)
        self.assertTrue(plex_token_mock.called)
        self.assertEqual(
            'http://localhost/library/all?type=1&userRating!=0'
            '&X-Plex-Container-Start=0&X-Plex-Container-Size=100'
            '&X-Plex-Token=ThisIsAMockToken', site.MY_RATINGS_URL)
예제 #7
0
 def __init__(self, args):
     super(PlexRatingsParser, self).__init__(Plex(args), args)
     self.processed_movies_count = 0
예제 #8
0
 def setUp(self):
     self.site = Plex(None)
예제 #9
0
 def __init__(self, args):
     super(PlexRatingsInserter, self).__init__(Plex(args), args)