示例#1
0
    def test_filename_generation(self):
        """
        Test the generation of the filename for given album data.
        """
        album, _ = process_data(self.get_test_data())

        self.assertEqual(_generate_filename(album), FILENAME)
示例#2
0
    def test_process_album(self):
        """
        Test the processing of the album information for a fetched data.
        """
        album, _ = process_data(self.get_test_data())

        self.assertEqual(album['collectionId'], 403822142)
        self.assertEqual(album['collectionName'],
                         'My Beautiful Dark Twisted Fantasy')
示例#3
0
    def test_process_songs(self):
        """
        Test the processing of the song information for a fetched data.
        """
        _, songs = process_data(self.get_test_data())

        self.assertEqual(songs[1][3]['kind'], 'song')
        self.assertEqual(songs[1][3]['discNumber'],  1)
        self.assertEqual(songs[1][3]['trackNumber'], 3)
        self.assertEqual(songs[1][3]['trackName'], 'Power')
示例#4
0
    def test_log_file_saving(self):
        """
        Test the log file creation for given test data.
        """
        test_data = self.get_test_data()
        album, _ = process_data(test_data)

        save_log(test_data, self.log_dir, album)

        with open(os.path.join(self.log_dir, FILENAME), 'r') as f:
            actual = f.read()

        self.assertEqual(actual, test_data)