class TestHttpFullPageFunctions(unittest.TestCase):

    def setUp(self):
        self.checker = HTTPFullPageCheck()
        self.http_schedule = MaintenanceScheduleProxy("test.webdav.org") 
        
        valid_auth = {
            "http_params": {"a_key":"a_value"},
            "http_headers": {"a_key":"a_value"},
            "http_match_type": "present_exact",
            "http_match_string": "WebDAV",
            "username": "******",
            "password": "******",
            "http_request_type": "GET"
        }
        
        self.valid_basic_auth = dict(valid_auth, **{
            "uri": "/auth-basic/",
            "http_auth_type": "basic"
        })
        
        self.valid_digest_auth = dict(valid_auth, **{
            "uri": "/auth-digest/",
            "http_auth_type": "digest"
        })
        
        self.invalid_basic_auth = dict(self.valid_basic_auth, **{
            "username": "******",
            "password": "******",
        })
        
        self.invalid_digest_auth = dict(self.valid_digest_auth, **{
            "username": "******",
            "password": "******",
        })
        
    def test_valid_basic_authentication(self):
        result = self.checker.check(self.http_schedule, self.valid_basic_auth)[1]
        self.assertEqual(result, 1)
        
    def test_valid_digest_authentication(self):
        result = self.checker.check(self.http_schedule, self.valid_digest_auth)[1]
        self.assertEqual(result, 1)

    def test_invalid_basic_authentication(self):
        result = self.checker.check(self.http_schedule, self.invalid_basic_auth)[1]
        self.assertEqual(result, 1)
        
    def test_invalid_digest_authentication(self):
        result = self.checker.check(self.http_schedule, self.invalid_digest_auth)[1]
        self.assertEqual(result, 1)
 def setUp(self):
     self.checker = HTTPFullPageCheck()
     self.http_schedule = MaintenanceScheduleProxy("test.webdav.org") 
     
     valid_auth = {
         "http_params": {"a_key":"a_value"},
         "http_headers": {"a_key":"a_value"},
         "http_match_type": "present_exact",
         "http_match_string": "WebDAV",
         "username": "******",
         "password": "******",
         "http_request_type": "GET"
     }
     
     self.valid_basic_auth = dict(valid_auth, **{
         "uri": "/auth-basic/",
         "http_auth_type": "basic"
     })
     
     self.valid_digest_auth = dict(valid_auth, **{
         "uri": "/auth-digest/",
         "http_auth_type": "digest"
     })
     
     self.invalid_basic_auth = dict(self.valid_basic_auth, **{
         "username": "******",
         "password": "******",
     })
     
     self.invalid_digest_auth = dict(self.valid_digest_auth, **{
         "username": "******",
         "password": "******",
     })