コード例 #1
0
    def test_download(self):
        # Note: the URL intentionally has a space at the end
        URL = "https://raw.github.com/okfn/bibserver/master/test/data/sample.bibtex "
        t = ingest.IngestTicket(owner="tester", collection="test", format="bibtex", source_url=URL)
        assert t["state"] == "new"
        t.save()
        assert len(ingest.get_tickets()) == 1

        ingest.determine_action(t)
        assert t["state"] == "downloaded"
        assert t["data_md5"] == "b61489f0a0f32a26be4c8cfc24574c0e"
コード例 #2
0
ファイル: test_ingest.py プロジェクト: okfn/bibserver
 def test_download(self):
     # Note: the URL intentionally has a space at the end
     URL = 'https://raw.github.com/okfn/bibserver/master/test/data/sample.bibtex '
     t = ingest.IngestTicket(owner='tester', 
                                  collection='test', format='bibtex', source_url=URL)
     assert t['state'] == 'new'
     t.save()
     assert len(ingest.get_tickets()) == 1
     
     ingest.determine_action(t)
     assert t['state'] == 'downloaded'
     assert t['data_md5'] == 'b61489f0a0f32a26be4c8cfc24574c0e'
コード例 #3
0
 def test_download(self):
     # Note: the URL intentionally has a space at the end
     URL = 'https://raw.github.com/okfn/bibserver/master/test/data/sample.bibtex '
     t = ingest.IngestTicket(owner='tester', 
                                  collection='test', format='bibtex', source_url=URL)
     assert t['state'] == 'new'
     t.save()
     assert len(ingest.get_tickets()) == 1
     
     ingest.determine_action(t)
     assert t['state'] == 'downloaded'
     assert t['data_md5'] == 'b61489f0a0f32a26be4c8cfc24574c0e'
コード例 #4
0
ファイル: test_web.py プロジェクト: jasonzou/MyPapers
 def test_upload_post(self):
     startnum = dao.Record.query()['hits']['total']
     res = self.app.post('/upload?format=bibtex&collection='+urllib.quote_plus('"My Test Collection"'),
         data = {'upfile': (open('test/data/sample.bibtex'), 'sample.bibtex')},
         headers={'REMOTE_USER': Fixtures.account.id}
         )
     assert res.status == '302 FOUND', res.status
     # Now we have to trigger the ingest handling of the ticket
     # which is normally done asynchronously
     for state in ('new', 'downloaded', 'parsed'):
         for t in ingest.get_tickets(state):
             ingest.determine_action(t)
     
     endnum = dao.Record.query()['hits']['total']
     assert_equal(endnum, startnum+1)
コード例 #5
0
ファイル: test_web.py プロジェクト: jasonzou/MyPapers
    def test_upload_post(self):
        startnum = dao.Record.query()['hits']['total']
        res = self.app.post('/upload?format=bibtex&collection=' +
                            urllib.quote_plus('"My Test Collection"'),
                            data={
                                'upfile': (open('test/data/sample.bibtex'),
                                           'sample.bibtex')
                            },
                            headers={'REMOTE_USER': Fixtures.account.id})
        assert res.status == '302 FOUND', res.status
        # Now we have to trigger the ingest handling of the ticket
        # which is normally done asynchronously
        for state in ('new', 'downloaded', 'parsed'):
            for t in ingest.get_tickets(state):
                ingest.determine_action(t)

        endnum = dao.Record.query()['hits']['total']
        assert_equal(endnum, startnum + 1)
コード例 #6
0
 def test_get_tickets(self):
     tckts = ingest.get_tickets()
     assert len(tckts) > 0
     for t in tckts:
         assert 'tester/test,' in str(t)
コード例 #7
0
ファイル: test_ingest.py プロジェクト: okfn/bibserver
 def test_get_tickets(self):
     tckts = ingest.get_tickets()
     assert len(tckts) > 0
     for t in tckts:
         assert 'tester/test,' in str(t)