Esempio n. 1
0
 def test_header_bad(self, mock_head):
     self.input.group.return_value = 'https://vtluug.org truncatedcone'
     mock_head.return_value = {'server': 'HTTPlikeapro'}
     head.head(self.phenny, self.input)
     mock_head.assert_called_once_with('https://vtluug.org')
     self.phenny.say.assert_called_once_with('There was no truncatedcone '
         'header in the response.')
Esempio n. 2
0
 def test_header_bad(self, mock_head):
     self.input.group.return_value = 'https://vtluug.org truncatedcone'
     mock_head.return_value = {'server': 'HTTPlikeapro'}
     head(self.phenny, self.input)
     mock_head.assert_called_once_with('https://vtluug.org')
     self.phenny.say.assert_called_once_with('There was no truncatedcone '
         'header in the response.')
Esempio n. 3
0
 def test_head_404(self, mock_head):
     self.input.group.return_value = 'https://vtluug.org/trigger_404'
     mock_head.side_effect = HTTPError(response=MagicMock(
         status_code='404'))
     head.head(self.phenny, self.input)
     mock_head.assert_called_once_with('https://vtluug.org/trigger_404')
     self.assertIn('404', self.phenny.say.call_args[0][0])
Esempio n. 4
0
    def test_head(self):
        input = Mock(group=lambda x: 'http://vtluug.org')
        head(self.phenny, input)

        out = self.phenny.reply.call_args[0][0]
        m = re.match('^200, text/html, utf-8, \d{4}\-\d{2}\-\d{2} '\
                '\d{2}:\d{2}:\d{2} UTC, [0-9\.]+ s$', out, flags=re.UNICODE)
        self.assertTrue(m)
Esempio n. 5
0
    def test_head(self):
        input = Mock(group=lambda x: 'http://vtluug.org')
        head(self.phenny, input)

        out = self.phenny.reply.call_args[0][0]
        m = re.match('^200, text/html, utf-8, \d{4}\-\d{2}\-\d{2} '\
                '\d{2}:\d{2}:\d{2} UTC, [0-9\.]+ s$', out, flags=re.UNICODE)
        self.assertTrue(m)
Esempio n. 6
0
    def test_head(self, mock_head):
        self.input.group.return_value = 'https://vtluug.org'
        mock_head.return_value = {
            'Status': '200',
            'content-type': 'text/html; charset=utf-8',
            'last-modified': 'Thu, 29 Dec 2016 22:49:19 GMT',
            'content-length': '1000'
        }
        head.head(self.phenny, self.input)

        mock_head.assert_called_once_with('https://vtluug.org')
        out = self.phenny.reply.call_args[0][0]
        m = re.match('^200, text/html, utf-8, \d{4}\-\d{2}\-\d{2} '\
                '\d{2}:\d{2}:\d{2} UTC, 1000 bytes, [0-9\.]+ s$', out, flags=re.UNICODE)
        self.assertTrue(m)
Esempio n. 7
0
    def test_head(self, mock_head):
        self.input.group.return_value = 'https://vtluug.org'
        mock_head.return_value = {
            'Status': '200',
            'content-type': 'text/html; charset=utf-8',
            'last-modified': 'Thu, 29 Dec 2016 22:49:19 GMT',
            'content-length': '1000'
        }
        head(self.phenny, self.input)

        mock_head.assert_called_once_with('https://vtluug.org')
        out = self.phenny.reply.call_args[0][0]
        m = re.match('^200, text/html, utf-8, \d{4}\-\d{2}\-\d{2} '\
                '\d{2}:\d{2}:\d{2} UTC, 1000 bytes, [0-9\.]+ s$', out, flags=re.UNICODE)
        self.assertTrue(m)
Esempio n. 8
0
    def test_header_bad(self):
        input = Mock(group=lambda x: 'http://vtluug.org truncatedcone')
        head(self.phenny, input)

        self.phenny.say.assert_called_once_with("There was no truncatedcone "\
                "header in the response.")
Esempio n. 9
0
    def test_header(self):
        input = Mock(group=lambda x: 'http://vtluug.org Server')
        head(self.phenny, input)

        self.phenny.say.assert_called_once_with("Server: nginx")
Esempio n. 10
0
    def test_head_404(self):
        input = Mock(group=lambda x: 'http://vtluug.org/trigger_404')
        head(self.phenny, input)

        out = self.phenny.say.call_args[0][0]
        self.assertEqual(out, '404')
Esempio n. 11
0
    def test_header_bad(self):
        input = Mock(group=lambda x: 'http://vtluug.org truncatedcone')
        head(self.phenny, input)

        self.phenny.say.assert_called_once_with("There was no truncatedcone "\
                "header in the response.")
Esempio n. 12
0
    def test_header(self):
        input = Mock(group=lambda x: 'http://vtluug.org Server')
        head(self.phenny, input)

        self.phenny.say.assert_called_once_with("Server: nginx")
Esempio n. 13
0
    def test_head_404(self):
        input = Mock(group=lambda x: 'http://vtluug.org/trigger_404')
        head(self.phenny, input)

        out = self.phenny.say.call_args[0][0]
        self.assertEqual(out, '404')
Esempio n. 14
0
 def test_header(self, mock_head):
     self.input.group.return_value = 'https://vtluug.org Server'
     mock_head.return_value = {'server': 'HTTPlikeapro'}
     head.head(self.phenny, self.input)
     mock_head.assert_called_once_with('https://vtluug.org')
     self.phenny.say.assert_called_once_with('Server: HTTPlikeapro')
Esempio n. 15
0
 def test_head_404(self, mock_head):
     self.input.group.return_value = 'https://vtluug.org/trigger_404'
     mock_head.side_effect = HTTPError(response=MagicMock(status_code='404'))
     head.head(self.phenny, self.input)
     mock_head.assert_called_once_with('https://vtluug.org/trigger_404')
     self.assertIn('404', self.phenny.say.call_args[0][0])
Esempio n. 16
0
 def test_header(self, mock_head):
     self.input.group.return_value = 'https://vtluug.org Server'
     mock_head.return_value = {'server': 'HTTPlikeapro'}
     head(self.phenny, self.input)
     mock_head.assert_called_once_with('https://vtluug.org')
     self.phenny.say.assert_called_once_with('Server: HTTPlikeapro')