示例#1
0
 def test_that_get_info_windows_works_for_old_spotify(self, mock_window):
     """
     test that get_info_windows parses song, artist correctly from the Spotify window
     """
     song, artist = get_info_windows()
     self.assertEqual(song, 'Youth (feat. Khalid)')
     self.assertEqual(artist, 'Shawn Mendes')
示例#2
0
    def test_get_info_windows_error_handling(self, mock_win32gui_1,
                                             mock_win32gui_2):
        """
		test that get_info_windows return None when it doesn't find
		"""
        x = get_info_windows()
        self.assertEqual(x, None)
示例#3
0
    def test_that_get_info_windows_works_for_new_spotify(self, mw_path, mw_proc, mock_window_class, mock_window_text):
        """
        test that get_info_windows parses song, artist correctly from the Spotify window
        """
        def w_text():
            yield ''
            while True:
                yield 'Adele - Hello'
        window_text = w_text()
        mock_window_text.side_effect = window_text

        song, artist = get_info_windows()
        self.assertEqual(song, 'Hello')
        self.assertEqual(artist, 'Adele')
示例#4
0
    def test_that_get_info_windows_works_for_false_positive(self, mw_path, mw_proc, mock_window_class, mock_window_text):
        """
        test that get_info_windows parses song, artist correctly from the Spotify window
        """
        def w_text():
            yield ''
            yield 'Toolbox'
            while True:
                yield 'Adele - Hello'
        window_text = w_text()
        mock_window_text.side_effect = window_text

        def w_path():
            yield 'C:\\Users\\u\\AppData\\Roaming\\Spotify\\Toolbox.exe'
            while True:
                yield 'C:\\Users\\u\\AppData\\Roaming\\Spotify\\Spotify.exe'
        window_path = w_path()
        mw_path.side_effect = window_path

        song, artist = get_info_windows()
        self.assertEqual(song, 'Hello')
        self.assertEqual(artist, 'Adele')
示例#5
0
 def test_get_info_windows(self, mock_win32gui_1, mock_win32gui_2):
     """
     test that get_info_windows works
     """
     x = get_info_windows()
     self.assertEqual(x, ("Darkside", "Alan Walker"))