Beispiel #1
0
 def test_url_request_no_array(self):
     singleUrlTimeout = [""]
     self.assertEqual(
         link_check.requestUrl(singleUrlTimeout),
         "TIMEOUT",
         "Should be 'TIMEOUT'",
     )
Beispiel #2
0
 def test_url_request_timeout(self):
     singleUrlTimeout = ["https://mljbrackett.co"]
     self.assertEqual(
         link_check.requestUrl(singleUrlTimeout),
         "TIMEOUT",
         "Should be 'TIMEOUT'",
     )
Beispiel #3
0
 def test_url_good(self, mock_head):
     singleUrlGood = ["https://mljbrackett.com"]
     mock_head.return_value.status_code = 200
     for url in singleUrlGood:
         response = link_check.requestUrl(url)
     self.assertEqual(
         link_check.checkUrl(response, singleUrlGood),
         "GOOD",
         "Should be 'GOOD'",
     )
Beispiel #4
0
 def test_url_redirect(self, mock_head):
     singleUrlRedirect = ["http://mljbrackett.com"]
     mock_head.return_value.status_code = 300
     for url in singleUrlRedirect:
         response = link_check.requestUrl(url)
     self.assertEqual(
         link_check.singleUrlCheck(response, singleUrlRedirect),
         "REDIRECT",
         "Should be 'REDIRECT'",
     )
Beispiel #5
0
 def test_url_error(self, mock_head):
     singleUrlError = ["https://mljbrackett.com/notarealroute"]
     mock_head.return_value.status_code = 404
     for url in singleUrlError:
         response = link_check.requestUrl(url)
     self.assertEqual(
         link_check.singleUrlCheck(response, singleUrlError),
         "CLIENT/SERVER ISSUE",
         "Should be 'CLIENT/SERVER ISSUE'",
     )
Beispiel #6
0
 def test_url_request_300(self, mock_head):
     singleUrl300 = ["http://mljbrackett.com"]
     mock_head.return_value.status_code = 300
     response = link_check.requestUrl(singleUrl300)
     self.assertEqual(response, 300, "Should be 300")
Beispiel #7
0
 def test_url_request_400(self, mock_head):
     singleUrl400 = ["https://mljbrackett.com/notarealroute"]
     mock_head.return_value.status_code = 400
     response = link_check.requestUrl(singleUrl400)
     self.assertEqual(response, 400, "Should be 400")