def test_downloader_does_not_care_if_directory_already_exists(self): solnbr = 'FA-FOO-BAR-BAZ' downloader = AttachmentDownloader(shelf='test_attach', dl_dir='py_test_dls') downloader.create_dir_by_solnbr(solnbr) downloader.create_dir_by_solnbr(solnbr) # clean up os.rmdir(downloader.dir_for_solnbr(solnbr))
def test_creates_solnbr_download_directory(self): solnbr = 'FA-FOO-BAR-BAZ' downloader = AttachmentDownloader(shelf='test_attach', dl_dir='py_test_dls') dirpath = downloader.dir_for_solnbr(solnbr) downloader.create_dir_by_solnbr(solnbr) self.assertTrue(os.path.isdir(dirpath)) # clean up os.rmdir(dirpath) self.assertFalse(os.path.isdir(dirpath))
def test_constructs_solnbr_download_directory_name(self): downloader = AttachmentDownloader(shelf='test_attach', dl_dir='py_test_dls') self.assertEqual(downloader.dir_for_solnbr('FA-FOO-BAR-BAZ'), 'py_test_dls/FA-FOO-BAR-BAZ')