def test_get_authors_from_record(self):
     from invenio.bibrank_selfcites_indexer import get_authors_from_record
     from invenio.bibrank_selfcites_indexer import get_authors_tags
     from invenio.config import CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID
     old_config = CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID
     tags = get_authors_tags()
     CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID = 0
     self.assert_(get_authors_from_record(1, tags))
     CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID = 1
     get_authors_from_record(1, tags)
     CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID = old_config
 def test_get_authors_from_record(self):
     from invenio.bibrank_selfcites_indexer import get_authors_from_record
     from invenio.bibrank_selfcites_indexer import get_authors_tags
     from invenio.config import CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID
     old_config = CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID
     tags = get_authors_tags()
     CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID = 0
     self.assert_(get_authors_from_record(1, tags))
     CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID = 1
     get_authors_from_record(1, tags)
     CFG_BIBRANK_SELFCITES_USE_BIBAUTHORID = old_config
 def test_get_author_coauthors_list(self):
     from invenio.bibrank_selfcites_indexer import get_author_coauthors_list
     from invenio.bibrank_selfcites_indexer import get_authors_from_record
     from invenio.bibrank_selfcites_indexer import get_authors_tags
     tags = get_authors_tags()
     config = {'friends_threshold': 3}
     authors = get_authors_from_record(1, tags)
     self.assert_(get_author_coauthors_list(authors, config))
 def test_get_author_coauthors_list(self):
     from invenio.bibrank_selfcites_indexer import get_author_coauthors_list
     from invenio.bibrank_selfcites_indexer import get_authors_from_record
     from invenio.bibrank_selfcites_indexer import get_authors_tags
     tags = get_authors_tags()
     config = {'friends_threshold': 3}
     authors = get_authors_from_record(1, tags)
     self.assert_(get_author_coauthors_list(authors, config))
 def test_store_record(self):
     from invenio.bibrank_selfcites_indexer import store_record
     from invenio.bibrank_selfcites_indexer import get_authors_from_record
     from invenio.bibrank_selfcites_indexer import get_authors_tags
     from invenio.dbquery import run_sql
     tags = get_authors_tags()
     recid = 1
     authors = get_authors_from_record(recid, tags)
     sql = 'DELETE FROM rnkRECORDSCACHE WHERE id_bibrec = %s'
     run_sql(sql, (recid, ))
     store_record(recid, authors)
     sql = 'SELECT count(*) FROM rnkRECORDSCACHE WHERE id_bibrec = %s'
     count = run_sql(sql, (recid, ))[0][0]
     self.assert_(count)
 def test_store_record(self):
     from invenio.bibrank_selfcites_indexer import store_record
     from invenio.bibrank_selfcites_indexer import get_authors_from_record
     from invenio.bibrank_selfcites_indexer import get_authors_tags
     from invenio.dbquery import run_sql
     tags = get_authors_tags()
     recid = 1
     authors = get_authors_from_record(recid, tags)
     sql = 'DELETE FROM rnkRECORDSCACHE WHERE id_bibrec = %s'
     run_sql(sql, (recid,))
     store_record(recid, authors)
     sql = 'SELECT count(*) FROM rnkRECORDSCACHE WHERE id_bibrec = %s'
     count = run_sql(sql, (recid,))[0][0]
     self.assert_(count)
    def test_store_record_coauthors_with_none_deleted(self):
        from invenio.bibrank_selfcites_indexer import store_record_coauthors
        from invenio.bibrank_selfcites_indexer import get_authors_from_record
        from invenio.bibrank_selfcites_indexer import get_authors_tags
        from invenio.dbquery import run_sql
        tags = get_authors_tags()
        recid = 1
        config = {'friends_threshold': 3}
        authors = get_authors_from_record(recid, tags)

        sql = 'DELETE FROM rnkEXTENDEDAUTHORS WHERE id = %s'
        run_sql(sql, (recid, ))
        store_record_coauthors(recid, authors, [], authors, config)
        sql = 'SELECT count(*) FROM rnkEXTENDEDAUTHORS WHERE id = %s'
        count = run_sql(sql, (recid, ))[0][0]
        self.assert_(count)
    def test_store_record_coauthors_with_none_deleted(self):
        from invenio.bibrank_selfcites_indexer import store_record_coauthors
        from invenio.bibrank_selfcites_indexer import get_authors_from_record
        from invenio.bibrank_selfcites_indexer import get_authors_tags
        from invenio.dbquery import run_sql
        tags = get_authors_tags()
        recid = 1
        config = {'friends_threshold': 3}
        authors = get_authors_from_record(recid, tags)

        sql = 'DELETE FROM rnkEXTENDEDAUTHORS WHERE id = %s'
        run_sql(sql, (recid,))
        store_record_coauthors(recid, authors, [], authors, config)
        sql = 'SELECT count(*) FROM rnkEXTENDEDAUTHORS WHERE id = %s'
        count = run_sql(sql, (recid,))[0][0]
        self.assert_(count)