def test_PullPageLinkTitleDescriptionToArrayGetTitle(self):
     testPullPageLinkTitleDescriptionToArray = PullPageLinkTitleDescriptionToArray(
         'https://www.google.com/')
     self.assertIsNotNone(
         testPullPageLinkTitleDescriptionToArray.getTitle())
     self.assertEqual('Google',
                      testPullPageLinkTitleDescriptionToArray.getTitle())
 def test_PullPageLinkTitleDescriptionToArrayGetDescription(self):
     testPullPageLinkTitleDescriptionToArray = PullPageLinkTitleDescriptionToArray(
         'https://www.google.com/')
     self.assertNotEqual(
         '', testPullPageLinkTitleDescriptionToArray.getDescription())
     self.assertGreater(
         len(testPullPageLinkTitleDescriptionToArray.getDescription()), 10)
Пример #3
0
    def test_PopulateEmptyLinkBodyUsingDatabaseLinkUrl(self):
        # need to first insert a link that has an empty linkbody for testing
        db = SUDBConnect()
        db.insertUpdateOrDeleteDB(
            "delete from dbo.LinkCrawlerHrefs where linkurl='http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'"
        )
        InsertScholarshipArrayIntoDatabase.doInsert(
            PullPageLinkTitleDescriptionToArray(
                'http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'
            ).doArray())
        rows = db.getRowsDB(
            "select * from LinkCrawlerHrefs where linkurl='http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'"
        )
        self.assertEqual(
            rows[0].LinkUrl,
            'http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'
        )

        # now actual testing of the class
        PopulateEmptyLinkBodyUsingDatabaseLinkUrl()

        rows = db.getRowsDB(
            "select * from LinkCrawlerHrefs where linkurl='http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'"
        )
        self.assertGreater(len(rows[0].LinkBody), 10)
 def test_PullPageLinkTitleDescriptionToArray(self):
     testPullPageLinkTitleDescriptionToArray = PullPageLinkTitleDescriptionToArray(
         'http://grandcanyon.com')
     self.assertEqual(
         4, len(testPullPageLinkTitleDescriptionToArray.doArray()))
     self.assertEqual(testPullPageLinkTitleDescriptionToArray.pageurl,
                      testPullPageLinkTitleDescriptionToArray.doArray()[0])
     self.assertEqual(testPullPageLinkTitleDescriptionToArray.title,
                      testPullPageLinkTitleDescriptionToArray.doArray()[1])
     self.assertEqual(testPullPageLinkTitleDescriptionToArray.description,
                      testPullPageLinkTitleDescriptionToArray.doArray()[2])
     self.assertEqual(testPullPageLinkTitleDescriptionToArray.allurlsonpage,
                      testPullPageLinkTitleDescriptionToArray.doArray()[3])
     print(testPullPageLinkTitleDescriptionToArray.doArray())
 def test_PullPageLinkTitleDescriptionToArray(self):
     testPullPageLinkTitleDescriptionToArray = PullPageLinkTitleDescriptionToArray('http://grandcanyon.com')
     self.assertEqual(4, len(testPullPageLinkTitleDescriptionToArray.doArray()))
     self.assertEqual(testPullPageLinkTitleDescriptionToArray.pageurl,
                      testPullPageLinkTitleDescriptionToArray.doArray()[0])
     self.assertEqual(testPullPageLinkTitleDescriptionToArray.title,
                      testPullPageLinkTitleDescriptionToArray.doArray()[1])
     self.assertEqual(testPullPageLinkTitleDescriptionToArray.description,
                      testPullPageLinkTitleDescriptionToArray.doArray()[2])
     self.assertEqual(testPullPageLinkTitleDescriptionToArray.allurlsonpage,
                      testPullPageLinkTitleDescriptionToArray.doArray()[3])
     print(testPullPageLinkTitleDescriptionToArray.doArray())
Пример #6
0
 def test_InsertScholarshipArrayIntoDatabase(self):
     db = SUDBConnect()
     db.insertUpdateOrDeleteDB(
         "delete from dbo.LinkCrawlerHrefs where linkurl='http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'"
     )
     InsertScholarshipArrayIntoDatabase.doInsert(
         PullPageLinkTitleDescriptionToArray(
             'http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'
         ).doArray())
     rows = db.getRowsDB(
         "select * from LinkCrawlerHrefs where linkurl='http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'"
     )
     self.assertEqual(
         rows[0].LinkUrl,
         'http://colleges.fastweb.com/d-foreign-languages-literatures-and-linguistics'
     )
 def test_PullPageLinkTitleDescriptionToArrayGetTitle(self):
     testPullPageLinkTitleDescriptionToArray = PullPageLinkTitleDescriptionToArray('https://www.google.com/')
     self.assertIsNotNone(testPullPageLinkTitleDescriptionToArray.getTitle())
     self.assertEqual('Google', testPullPageLinkTitleDescriptionToArray.getTitle())
 def test_PullPageLinkTitleDescriptionToArrayGetAllURLsOnPage(self):
     testPullPageLinkTitleDescriptionToArray = PullPageLinkTitleDescriptionToArray('http://grandcanyon.com')
     self.assertGreater(len(testPullPageLinkTitleDescriptionToArray.getAllURLsOnPage()), 1)
 def test_PullPageLinkTitleDescriptionToArrayGetDescription(self):
     testPullPageLinkTitleDescriptionToArray = PullPageLinkTitleDescriptionToArray('https://www.google.com/')
     self.assertNotEqual('', testPullPageLinkTitleDescriptionToArray.getDescription())
     self.assertGreater(len(testPullPageLinkTitleDescriptionToArray.getDescription()), 10)
 def test_PullPageLinkTitleDescriptionToArrayGetAllURLsOnPage(self):
     testPullPageLinkTitleDescriptionToArray = PullPageLinkTitleDescriptionToArray(
         'http://grandcanyon.com')
     self.assertGreater(
         len(testPullPageLinkTitleDescriptionToArray.getAllURLsOnPage()), 1)