Beispiel #1
0
 def test_selectplatformcoursename2(self):
     a = Course(course_name="物理", course_type="sss", course_url="4399", platform_name="s")
     b = Course(course_name="化学", course_type="sss", course_url="4399d", platform_name="rt")
     c=Course(course_name="高数", course_type="sss", course_url="4399s", platform_name="rt")
     s = [a, b,c]
     db.insert_courses_table(s)
     self.assertEqual(db.select_platform_course_name("rt"," "),[])
Beispiel #2
0
 def test_selecttypeaccuracy3(self):
     a = Course(course_name="物理", course_type="sss", course_url="4399", platform_name="s")
     b = Course(course_name="化学", course_type="sss", course_url="4399d", platform_name="rt")
     c = Course(course_name="高数", course_type="sss", course_url="4399s", platform_name="rt")
     s = [a, b, c]
     db.insert_courses_table(s)
     self.assertEqual(db.select_course_type_accuracy(None),None)
Beispiel #3
0
 def test_selectplatformname3(self):
     a = Course(course_name="这是一个测试", course_type="ss", course_url="4399", platform_name="f")
     b = Course(course_name="这是一个测试", course_type="sss", course_url="4399d", platform_name="rt")
     c=Course(course_name="这是s测试", course_type="325s", course_url="439d", platform_name="y")
     s = [a, b]
     db.insert_courses_table(s)
     self.assertEqual(db.select_platform_name(c.platform_name),[])
Beispiel #4
0
 def test_selectcoursetype2(self):
     a = Course(course_name="这是一个测试", course_type="sss", course_url="4399", platform_name="")
     b = Course(course_name="这是一个测试", course_type="sss", course_url="4399d", platform_name="rt")
     s = [a, b]
     db.insert_courses_table(s)
     self.assertEqual(db.select_course_type("ss")[0].course_type,a.course_type)
     self.assertEqual(db.select_course_type(a.course_type)[1].course_type,a.course_type)
Beispiel #5
0
 def test_deleteid3(self):
     a = Course(course_name="这是一个测试",
                course_type="ss",
                course_url="4399",
                platform_name="")
     b = Course(course_name="这是一个测试",
                course_type="sss",
                course_url="4399d",
                platform_name="rt")
     s = [a, b]
     db.drop_course_table()
     db.init_course_table()
     db.insert_courses_table(s)
     # print(db.select_all_course()[0].id)
     self.assertFalse(db.delete_course_table2(None))
     a = Course(course_name="这是一个测试",
                course_type="ss",
                course_url="4399",
                platform_name="")
     b = Course(course_name="这是一个测试",
                course_type="sss",
                course_url="4399d",
                platform_name="rt")
     s = [a, b]
     db.drop_course_table()
     db.init_course_table()
     db.insert_courses_table(s)
     # print(db.select_all_course()[0].id)
     self.assertFalse(db.delete_course_table2(None))
Beispiel #6
0
 def test_delete3(self):
     a = Course(course_name="这是一个测试", course_type="ss", course_url="4399", platform_name="")
     b = Course(course_name="这是一个测试", course_type="sss", course_url="4399d", platform_name="rt")
     s = [a, b]
     db.insert_courses_table(s)
     c = Course(course_name="测试", course_type="ssds", course_url="sjw", platform_name="t")
     self.assertTrue(db.delete_course_table(c))
Beispiel #7
0
 def test_update1(self):
     a = Course(course_name="这是一个测试", course_type="ss", course_url="4399", platform_name="")
     b = Course(course_name="这是一个测试", course_type="sss", course_url="4399d", platform_name="rt")
     s = [a, b]
     c = Course(course_name="这个测试", course_type="sss", course_url="4399", platform_name="r")
     db.drop_course_table()
     db.init_course_table()
     db.insert_courses_table(s)
     self.assertTrue(db.update_course_table(1, c))
 def test_course(self):
     a = Course(course_name="这是一个测试",
                course_type="ss",
                course_url="4399",
                platform_name="")
     b = Course(course_name="这是一个测试",
                course_type="sss",
                course_url="4399d",
                platform_name="rt")
     s = [a, b]
     db.insert_courses_table(s)
Beispiel #9
0
 def test_selectall1(self):
     a = Course(course_name="这是一个测试",
                course_type="sss",
                course_url="4399",
                platform_name="s")
     b = Course(course_name="这是一个测试",
                course_type="sss",
                course_url="4399d",
                platform_name="rt")
     s = [a, b]
     db.insert_courses_table(s)
     self.assertEqual(db.select_all_course()[0].course_name, a.course_name)
Beispiel #10
0
 def test_delete4(self):
     a = Course(course_name="这是一个测试",
                course_type="ss",
                course_url="4399",
                platform_name="")
     b = Course(course_name="这是一个测试",
                course_type="sss",
                course_url="4399d",
                platform_name="rt")
     s = [a, b]
     db.insert_courses_table(s)
     self.assertFalse(db.delete_course_table(None))
Beispiel #11
0
 def test_selectplatformname4(self):
     a = Course(course_name="这是一个测试",
                course_type="ss",
                course_url="4399",
                platform_name="")
     b = Course(course_name="这是一个测试",
                course_type="sss",
                course_url="4399d",
                platform_name="rt")
     s = [a, b]
     db.insert_courses_table(s)
     self.assertEqual(db.select_platform_name(None), None)
Beispiel #12
0
 def test_update2(self):
     a = Course(course_name="这是一个测试", course_type="ss", course_url="4399", platform_name="")
     b = Course(course_name="这是一个测试", course_type="sss", course_url="4399d", platform_name="rt")
     s = [a, b]
     c = Course(course_name="这个测试", course_type="sss", course_url="4399", platform_name="r")
     db.drop_course_table()
     db.init_course_table()
     db.insert_courses_table(s)
     self.assertTrue(db.update_course_table(3, c))
     #print(db.select_all_course()[3].course_name)
     self.assertFalse(db.update_course_table(None, None))
     self.assertFalse(db.update_course_table(1, None))
     self.assertFalse(db.update_course_table(None, c))
Beispiel #13
0
 def test_insertmany5(self):
     a = Course(course_name="这一个测试",
                course_type="ss",
                course_url="4399",
                platform_name="")
     b = None
     s = [a, b]
     self.assertTrue(db.insert_courses_table(s))
Beispiel #14
0
    def test_insertmany6(self):

        a = Course(course_name="这是一个测试",
                   course_type="ss",
                   course_url="4399d",
                   platform_name="")
        b = Course(course_name="这是一个测试",
                   course_type="sss",
                   course_url="4399d",
                   platform_name="rt")
        s = [a, b]
        self.assertTrue(db.insert_courses_table(s))
Beispiel #15
0
from ShareForm_Flask.flask_db import db
from WebWorms import app8_getIMooc, app9_getIMoocJava, WebWorm_bilibili, aiqiyi, app10_getIMoocCSharp, \
    app11_getIMoocCPlusPlus, app13_getIMoocPHP, app16_getYoukuTed

if __name__ == '__main__':
    db.drop_course_table()
    db.init_course_table()
    mylist = app8_getIMooc.getInfoFromImmocForPython()
    db.insert_courses_table(mylist)
    mylist = app9_getIMoocJava.getInfoFromIMoocForJava()
    db.insert_courses_table(mylist)
    mylist = WebWorm_bilibili.worm_bilibili_python()
    db.insert_courses_table(mylist)
    mylist = WebWorm_bilibili.worm_bilibili_java()
    db.insert_courses_table(mylist)
    mylist = WebWorm_bilibili.worm_bilibili_C()
    db.insert_courses_table(mylist)
    mylist = WebWorm_bilibili.worm_bilibili_Pr()
    db.insert_courses_table(mylist)
    mylist = WebWorm_bilibili.worm_bilibili_PS()
    db.insert_courses_table(mylist)
    mylist = aiqiyi.aiqiyi_Python()
    db.insert_courses_table(mylist)
    mylist = app10_getIMoocCSharp.getInfoFromIMoocForCSharp()
    db.insert_courses_table(mylist)
    mylist = app11_getIMoocCPlusPlus.getInfoFromIMoocForCPlusPlus()
    db.insert_courses_table(mylist)
    mylist = app13_getIMoocPHP.getInfoFromIMoocForPHP()
    db.insert_courses_table(mylist)
    mylist = app16_getYoukuTed.getInfoFromTedForChina()
    db.insert_courses_table(mylist)
Beispiel #16
0
 def test_insertmany3(self):
     s = None
     self.assertFalse(db.insert_courses_table(s))
Beispiel #17
0
    def test_insertmany2(self):

        s = []
        self.assertFalse(db.insert_courses_table(s))
Beispiel #18
0
 def test_insertmany4(self):
     a = Course(course_name="这s一个测试", course_type="ssdfsjklkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkks", course_url="4399", platform_name="")
     b = Course(course_name="这是一个测试", course_type="sss", course_url="4399d", platform_name="rt")
     s = [a, b]
     self.assertFalse(db.insert_courses_table(s))
Beispiel #19
0
 def test_course(self):
     a = Course(course_name="这是一个测试",
                course_type="ss",
                course_url="4399",
                platform_name="")
     b = Course(course_name="这是一个测试",
                course_type="sss",
                course_url="4399d",
                platform_name="rt")
     s = [a, b]
     db.insert_courses_table(s)
     #c=COurse(course_name=)
     self.assertTrue(
         db.insert_course_table(
             Course(course_name="s",
                    course_type="ss",
                    course_url="757",
                    platform_name="1);DROP ALL TABLE--")))
     self.assertEqual(db.select_all_course()[0].course_name, a.course_name)
     db.delete_all_course_table()
     a = Course(course_name="TABLE",
                course_type="ss",
                course_url="4399",
                platform_name="1);DROP ALL TABLE--")
     b = Course(course_name="ALL",
                course_type="sss",
                course_url="4399d",
                platform_name="1);DROP ALL TABLE--")
     s = [a, b]
     self.assertTrue(db.insert_courses_table(s))
     self.assertEqual(db.select_all_course()[0].course_name, a.course_name)
     self.assertTrue(db.delete_course_table(b))
     self.assertEqual(db.select_all_course()[0].course_name, a.course_name)
     db.drop_course_table()
     db.init_course_table()
     a = Course(course_name="TABLE",
                course_type="ss",
                course_url="4399",
                platform_name="1);DROP TABLE if exists COURSE;--")
     b = Course(course_name="ALL",
                course_type="sss",
                course_url="4399d",
                platform_name="1);DROP TABLE if exists COURSE;--")
     s = [a, b]
     db.insert_courses_table(s)
     self.assertFalse(db.delete_course_table2("1);DROP ALL TABLE--"))
     self.assertEqual(db.select_all_course()[0].course_name, a.course_name)
     self.assertTrue(
         db.update_course_table(
             1,
             Course(course_name="TABLE",
                    course_type="ss",
                    course_url="4399",
                    platform_name="1);DROP TABLE if exists COURSE;--")))
     self.assertEqual(
         db.select_course_name("5);DROP TABLE if exists COURSE;--"), [])
     self.assertEqual(
         db.select_course_type("5);DROP TABLE if exists COURSE;--"), [])
     self.assertEqual(
         db.select_platform_name("5);DROP TABLE if exists COURSE;--"), [])
     self.assertEqual(
         db.select_course_type_accuracy(
             "5);DROP TABLE if exists COURSE;--"), [])
     self.assertEqual(
         db.select_platform_course_name(
             "s", "5);DROP TABLE if exists COURSE;--"), [])