def test_get_zip_feeds(self, mock_utc_now, mock_getpass): fake_time = datetime(2015, 9, 28, 12, 27) mock_utc_now.utcnow.return_value = fake_time mock_getpass.getuser.return_value = 'feeduser' feed_dir = os.path.join(os.path.dirname(__file__), 'data/zip_test_dir') feed_files = get_feeds_from_directory(feed_dir) self.assertEqual(3, len(feed_files)) for feed_file in feed_files: self.assertEqual(feed_file.uploaded_by_user, 'censio-feeduser') self.assertEqual(feed_file.date_added, fake_time) self.assertEqual(feed_file.description, 'Manual Upload')
def add_feed_zip(ctx, parallel, directory): db = ctx.obj['database'] db.create() feed_list = get_feeds_from_directory(directory) click.echo("Ready to load {} feeds".format(len(feed_list))) load_feeds(feed_list, db, parallel)