コード例 #1
0
ファイル: test.py プロジェクト: agrunfeld/article-downloader
class Tester(TestCase):
  def setUp(self):
    self.downloader = ArticleDownloader('NO_API_KEY')
    self.doi = '10.1016/j.nantod.2008.10.014'
    self.pdf_file = TemporaryFile(mode='wb')

    self.txt_file = TemporaryFile(mode='rb+')
    self.txt_file.write('10.1016/j.nantod.2008.10.014')

    self.csv_file = TemporaryFile(mode='rb+')
    self.csv_file.write('nanomaterial+synthesis,')
    self.csv_file.write('battery+electrode,')

  def test_download(self):
    #Single download test
    self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'elsevier')
    self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'crossref')

  def test_entitlement(self):
    #Test entitlement
    self.assertFalse(self.downloader.check_els_entitlement(self.doi))

  def test_search(self):
    #Search test
    queries = self.downloader.load_queries_from_csv(self.csv_file)
    for query in queries:
      self.downloader.get_dois_from_search(query, rows=1200)

  def tearDown(self):
    pass
コード例 #2
0
class Tester(TestCase):
    def setUp(self):
        self.downloader = ArticleDownloader(environ.get('ELS_API_KEY'))
        self.doi = '10.1016/j.nantod.2008.10.014'
        self.pdf_file = TemporaryFile(mode='wb')

        self.txt_file = TemporaryFile(mode='rb+')
        self.txt_file.write('10.1016/j.nantod.2008.10.014')

        self.csv_file = TemporaryFile(mode='rb+')
        self.csv_file.write('nanomaterial+synthesis,')
        self.csv_file.write('battery+electrode,')

    def test_download(self):
        #Single download test
        self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'elsevier')

    def test_abstract_download(self):
        self.downloader.get_abstract_from_doi(self.doi, 'elsevier')

    def test_search(self):
        #Search test
        queries = self.downloader.load_queries_from_csv(self.csv_file)
        for query in queries:
            self.downloader.get_dois_from_search(query, rows=10)

    def tearDown(self):
        pass
コード例 #3
0
ファイル: test.py プロジェクト: xukm/article-downloader
class Tester(TestCase):
  def setUp(self):
    self.downloader = ArticleDownloader(environ.get('ELS_API_KEY'))
    self.doi = '10.1016/j.nantod.2008.10.014'
    self.pdf_file = TemporaryFile(mode='wb')

    self.txt_file = TemporaryFile(mode='rb+')
    self.txt_file.write('10.1016/j.nantod.2008.10.014')

    self.csv_file = TemporaryFile(mode='rb+')
    self.csv_file.write('nanomaterial+synthesis,')
    self.csv_file.write('battery+electrode,')

  def test_download(self):
    #Single download test
    self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'elsevier')
    self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'crossref')
    self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'rsc')

  def test_abstract_download(self):
    self.downloader.get_abstract_from_doi(self.doi, 'elsevier')

  def test_entitlement(self):
    #Test entitlement - want to check this works, but pass/fail depends on IP addr
    self.assertTrue(self.downloader.check_els_entitlement(self.doi) in [True, False])

  def test_search(self):
    #Search test
    queries = self.downloader.load_queries_from_csv(self.csv_file)
    for query in queries:
      self.downloader.get_dois_from_search(query, rows=1000)

  def tearDown(self):
    pass
コード例 #4
0
ファイル: test.py プロジェクト: smaegol/article-downloader
class Tester(TestCase):
    def setUp(self):
        self.downloader = ArticleDownloader('NO_API_KEY')
        self.doi = '10.1016/j.nantod.2008.10.014'
        self.pdf_file = TemporaryFile(mode='wb')

        self.txt_file = TemporaryFile(mode='rb+')
        self.txt_file.write('10.1016/j.nantod.2008.10.014')

        self.csv_file = TemporaryFile(mode='rb+')
        self.csv_file.write('nanomaterial+synthesis,')
        self.csv_file.write('battery+electrode,')

    def test_download(self):
        #Single download test
        self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'elsevier')
        self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'crossref')

    def test_entitlement(self):
        #Test entitlement
        self.assertFalse(self.downloader.check_els_entitlement(self.doi))

    def test_search(self):
        #Search test
        queries = self.downloader.load_queries_from_csv(self.csv_file)
        for query in queries:
            self.downloader.get_dois_from_search(query, rows=1200)

    def tearDown(self):
        pass
コード例 #5
0
ファイル: test.py プロジェクト: eddotman/article-downloader
class Tester(TestCase):
  def setUp(self):
    self.downloader = ArticleDownloader(environ.get('ELS_API_KEY'))
    self.doi = '10.1016/j.nantod.2008.10.014'
    self.pdf_file = TemporaryFile(mode='wb')

    self.txt_file = TemporaryFile(mode='rb+')
    self.txt_file.write('10.1016/j.nantod.2008.10.014')

    self.csv_file = TemporaryFile(mode='rb+')
    self.csv_file.write('nanomaterial+synthesis,')
    self.csv_file.write('battery+electrode,')

  def test_download(self):
    #Single download test
    self.downloader.get_pdf_from_doi(self.doi, self.pdf_file, 'elsevier')

  def test_abstract_download(self):
    self.downloader.get_abstract_from_doi(self.doi, 'elsevier')

  def test_search(self):
    #Search test
    queries = self.downloader.load_queries_from_csv(self.csv_file)
    for query in queries:
      self.downloader.get_dois_from_search(query, rows=10)

  def tearDown(self):
    pass