def test_add_lang_casing(self): lang1 = "C" lang2 = lang1.lower() db_utils.add_lang(lang1) db_utils.add_lang(lang2) self.assertEqual(1, Language.query.filter(Language.language_name.ilike(lang1)).count()) self.assertEqual(1, Language.query.filter(Language.language_name.ilike(lang2)).count())
def test_add_repo_lang_existing(self): repo_id = 1 lang = "c" num = 1024 db_utils.add_lang(lang) db_utils.add_repo_lang(repo_id, lang, num) this_lang = Language.query.filter(Language.language_name.ilike(lang)).one() this_repo_lang = RepoLanguage.query.filter_by(repo_id=repo_id, language_id=this_lang.language_id).one() self.assertEqual(1024, this_repo_lang.language_bytes)
def test_add_repo_lang_new(self): repo_id = 1 lang = "Haskell" num = 512 db_utils.add_lang(lang) db_utils.add_repo_lang(repo_id, lang, num) this_lang = Language.query.filter(Language.language_name.ilike(lang)).one() this_repo_lang = RepoLanguage.query.filter_by(repo_id=repo_id, language_id=this_lang.language_id).one() self.assertEqual(512, this_repo_lang.language_bytes)
def test_add_lang_existing(self): lang = "c" db_utils.add_lang(lang) self.assertEqual(1, Language.query.filter(Language.language_name.ilike(lang)).count())
def test_add_lang_new(self): lang = "Haskell" db_utils.add_lang(lang) self.assertEqual(1, Language.query.filter(Language.language_name.ilike(lang)).count())