User:Alvonruff/ISFDB Tests

From ISFDB
Jump to navigation Jump to search

These are formal tests using the unittest module. The tests are mostly concerned with:

  • Testing return types (int, string, float, etc). We're especially interested in DATE fields returning as an str and not a datetime. Note that under python2 type(intVariable) returns:
    • <type 'int'>
  • While under python3 it returns:
    • <class 'int'>
  • Testing input arguments. Some of the methods will take, say a title_id, as either an int or a str. Some only str. Some only int. Maybe clean this up at a later date.
  • Testing for select statements that return nothing. Sometimes this returns an empty string, sometimes [], and sometimes 'None'

Although non-destructive, these tests should probably not be run against the production server. The goal is to be able to run the tests on both Python2 and Python3, and generate exactly the same results.

SQLparsing Tests

Author-Related Methods

These are mostly methods that perform a select on the authors table.

SQL Method Status
SQLAuthorsBorn(date) DONE
SQLAuthorsDied(date) DONE
SQLFindAuthors(target, mode = 'contains') DONE
SQLFindReviewParent(title, author, referral_lang)
SQLgetActualFromPseudo(au_id) DONE
SQLGetAllAuthorsForPublisher(publisher_id, sort_by) DONE
SQLgetAuthorData(author) DONE
SQLGetAuthorDirectory() DONE
SQLgetBriefActualFromPseudo(au_id) DONE
SQLgetBriefPseudoFromActual(au_id) DONE
SQLGetCoverAuthorsForPubs(pub_list) DONE
SQLInterviewAuthors(title_id) DONE
SQLInterviewBriefAuthorRecords(title_id) DONE
SQLIntervieweeAuthors(title_id, author_id = 0) DONE
SQLloadAuthorData(author_id) DONE
SQLLoadTransAuthorNamesList(author_ids) DONE
SQLMultipleAuthors(name) DONE
SQLPubAuthors(pub_id) DONE
SQLPubBriefAuthorRecords(pub_id) DONE
SQLPubListBriefAuthorRecords(pub_list) DONE
SQLReviewAuthors(title_id) DONE
SQLReviewBriefAuthorRecords(title_id) DONE
SQLReviewedAuthors(title_id) DONE
SQLTitleAuthors(title_id) DONE
SQLTitleBriefAuthorRecords(title_id) DONE
SQLTitleListBriefAuthorRecords(title_list, author_id = 0) DONE
SQLtransLegalNames(author_ids) DONE

Title-Related Methods

These are mostly methods that perform a select on the titles table.

SQL Method Status
SQLaddTagToTitle(tag, title_id, user_id)
SQLCountPubsForTitle(title_id)
SQLDeletedTitle(title_id)
SQLFindExactTitles(target)
SQLFindFictionTitles(target)
SQLfindReviewedTitle(review_id)
SQLFindSeriesTitles(target)
SQLFindTitles(target)
SQLgetAllTitleTags(title_id, parent_id, user_id)
SQLGetCoverPubsByTitle(titlerec)
SQLGetLangIdByTitle(title_id)
SQLGetPubsByTitle(titlerec)
SQLGetPubsByTitleNoParent(titlerec)
SQLGetPubsByTitleNoTranslations(titlerec)
SQLGetPubsForChildTitles(titlerec)
SQLgetPubTitle(pubId)
SQLgetTagsByTitleForTitleList(title_ids, user_id)
SQLgetTitle(titleId)
SQLgetTitleByTagId(tagmap_id)
SQLgetTitleListTags(title_list, user_id)
SQLgetTitleReferral(pub_id, pub_ctype, include_editors=0)
SQLgetTitleReferralList(pubs, include_editors=0)
SQLgetTitlesForAuthorAndTag(tag_id, author_id)
SQLgetTitlesForTag(tag_id, start)
SQLgetTitlesForTagForUser(tag_id, user_id, start)
SQLgetTitleTags(title_id)
SQLgetTitleTagsByUser(title_id)
SQLgetTitleVariants(title_id)
SQLloadAllAuthorTitles(aurec, page_type, languages_all, languages)
SQLloadAllTitleReviews(title_id)
SQLloadAnyTitles(aurec)
SQLLoadReviewsForTitle(title_id)
SQLLoadSeriesListTitles(series_list)
SQLloadTitle(titlerec)
SQLloadTitleFromAward(award_id)
SQLloadTitleList(title_ids)
SQLloadTitlesXBS(series)
SQLloadTitlesXBT(recno)
SQLloadTitleWebpages(title_id)
SQLloadTransPubTitles(pub_id)
SQLLoadTransPubTitlesList(pub_ids)
SQLloadTransTitles(title_id)
SQLLoadTransTitlesList(title_ids)
SQLloadVTsForAuthor(author_id)
SQLloadVTsForTitleList(title_list)
SQLTitleAuthors(title_id)
SQLTitleAwards(title_id)
SQLTitleBriefAuthorRecords(title_id)
SQLTitleListBriefAuthorRecords(title_list, author_id = 0)
SQLTitlesWithPubs(title_list)
SQLupdateTitleViews(title_id)

Publication-Related Methods

These are mostly methods that perform a select on the pubs table.

SQL Method Status
SQLGetFrontPagePubs(front_page)
SQLGetNextMonthPubs(additional_pubs = 0)
SQLGetPubByTag(tag)
SQLGetPubById(id)
SQLGetCoverAuthorsForPubs(pub_list)
SQLGetCoverPubsByTitle(titlerec)
SQLGetPubsByTitle(titlerec)
SQLGetPubsByTitleNoParent(titlerec)
SQLGetPubsByTitleNoTranslations(titlerec)
SQLGetPubsForChildTitles(titlerec)
SQLGetPubsByPublisherYear(publisher_id, year)
SQLGetPubsByAuthor(aurec)
SQLGetPubContentByAuthor(aurec)
SQLGetPublisher(pubrec)
SQLGetPublisherList(publisher_list)
SQLGetPublisherDirectory()
SQLGetPubSeries(pub_series_id)
SQLGetPubSeriesByName(pub_series_name)
SQLGetPubSeriesList(pub_series_list)
SQLLoadPubSeries(pub_series_ids)
SQLGetPubSeriesPubs(pub_series_id, display_order)
SQLCountPubsNotInPubSeries(publisher_id)
SQLGetPubsNotInSeries(publisher_id)
SQLFindPublisher(target, mode = 'contains')
SQLGetPublisherYears(publisher_id)
SQLFindPubSeries(target, mode = 'contains')
SQLFindPubsByIsbn(targets, excluded_pub_id = 0)
SQLFindPubsByCatalogId(value)
SQLFindPubSeriesForPublisher(publisher_id)
SQLgetPublisherName(id)
SQLPubBriefAuthorRecords(pub_id)
SQLPubListBriefAuthorRecords(pub_list)
SQLloadPublisherWebpages(publisher_id)
SQLloadTransPubSeriesNames(pub_series_id)
SQLLoadTransPubSeriesList(pub_series_ids)
SQLloadTransPublisherNames(publisher_id)
SQLLoadTransPublisherList(publisher_ids)
SQLloadTransPubTitles(pub_id)
SQLLoadTransPubTitlesList(pub_ids)
SQLloadPubSeriesWebpages(publisher_id)
SQLloadPubWebpages(pub_id)
SQLgetPubTitle(pubId)
SQLTitlesWithPubs(title_list)
SQLGetPubContentList(pub_id)
SQLPubArtists(pubid)
SQLPubCovers(pubid)
SQLFindPubByExternalID(id_type, id_value)
SQLCountPubsForTitle(title_id)
SQLDeletedPub(pubid)
SQLGetPubsForAuthorPublisher(publisher_id, author_id)

Award-Related Methods

These are mostly methods that perform a select on the awards table.

SQL Method Status
SQLloadTitleFromAward(award_id)
SQLloadAwardsXBA(author, titles, pseudonyms)
SQLloadAwardsForYearType(award_type_id, year)
SQLloadAwardsForCat(award_cat_id, win_nom)
SQLloadAwardsForCatYear(award_cat_id, award_year)
SQLTitleAwards(title_id)
SQLloadAwards(award_id)
SQLloadAwardTypeWebpages(award_type_id)
SQLloadAwardCatWebpages(award_cat_id)
SQLListAwardTypes()
SQLGetAwardTypeByCode(award_type_code)
SQLGetAwardTypeByName(award_type_name)
SQLGetAwardTypeByShortName(award_type_short_name)
SQLGetAwardTypeById(award_type_id)
SQLGetAwardYears(award_type_id)
SQLGetAwardCategories(award_type_id)
SQLGetAwardCatById(award_cat_id)
SQLGetAwardCatByName(award_cat_name, award_cat_type_id)
SQLSearchAwards(award)
SQLGetAwardCatBreakdown(award_type_id)
SQLGetEmptyAwardCategories(award_type_id)
SQLDeletedAward(award_id)
SQLDeletedAwardType(award_type_id)
SQLDeletedAwardCategory(award_cat_id)

Class Tests

authorClass Methods

SQL Method Status
load(self, id)
obj2xml(self)
xml2obj(self, xml)
cgi2obj(self)

awardcatClass Methods

SQL Method Status
load(self)
cgi2obj(self)
PrintAwardCatYear(self, year)
PrintAwardCatTable(self, years)
PrintAwardCatSummary(self, win_nom)
PrintAwardCatPageHeader(self)

awardClass Methods

awardtypeClass Methods

pubClass Methods

publisherClass Methods

pubseriesClass Methods

seriesClass Methods

templateClass Methods

titleClass Methods

verificationsourceClass Methods