def test_default_output(self): audio = Audio(['-l', 'https:\\link.com']) audio._Audio__parse_arguments() self.assertEqual( audio.output, os.path.join(os.path.join(os.getcwd(), 'Unknown'), "%(title)s.%(ext)s"))
def test_only_folder_help(self): with captured_output() as (out, err): with mock_mkdir(): Audio(['-f', 'The Cows'])._Audio__parse_arguments() output = out.getvalue().strip() self.assert_usage(output)
def test_folder_name(self): with mock_mkdir(): audio = Audio(['-f', 'The Cows']) audio._Audio__parse_arguments() self.assertEqual(audio.folder, os.path.join(os.getcwd(), 'The Cows'))
def test_only_folder(self): with mock_mkdir(): self.assertFalse( Audio(['-f', 'The Cows'])._Audio__parse_arguments())
def test_only_output_help(self): with captured_output() as (out, err): Audio(['-o', 'output.bla'])._Audio__parse_arguments() output = out.getvalue().strip() self.assert_usage(output)
def test_output_name(self): audio = Audio(['-o', 'output.wha']) audio._Audio__parse_arguments() self.assertEqual(audio.output, 'output.wha')
def test_only_output(self): self.assertFalse(Audio(['-o', 'output.kra'])._Audio__parse_arguments())
def test_multiple_link_names(self): audio = Audio(['-l', 'http:\\link.com,http:\\otherlink.com']) audio._Audio__parse_arguments() self.assertEqual(audio.links, ['http:\\link.com', 'http:\\otherlink.com'])
def test_only_link_argument_name(self): audio = Audio(['-l', 'http:\\link.com']) audio._Audio__parse_arguments() self.assertEqual(audio.links, ['http:\\link.com'])
def test_only_link_argument(self): self.assertTrue( Audio(['-l', 'http:\\link.com'])._Audio__parse_arguments())
def test_no_arguments(self): self.assertFalse(Audio('')._Audio__parse_arguments())
def test_default_folder(self): audio = Audio(['-l', 'https:\\link.com']) audio._Audio__parse_arguments() self.assertEqual(audio.folder, os.path.join(os.getcwd(), 'Unknown'))