示例#1
0
    def test_parse_page_success(self, mock_response):
        """test successful parse_page()."""
        mock_response.return_value = MockResponse(self.test_data, 200)

        data = rmap.parse_page()
        self.assertIsNotNone(data)
        self.assertIsInstance(data, str)

        json_data = json.loads(data)
        self.assertIn('Amazon Pinpoint', json_data.keys())
        self.assertIn('Endpoint', json_data.get('Amazon Pinpoint')[0])
        self.assertIn('Endpoint', json_data.get('Amazon Pinpoint')[0])
        self.assertIn('Protocol', json_data.get('Amazon Pinpoint')[0])
        self.assertIn('Region', json_data.get('Amazon Pinpoint')[0])
        self.assertIn('Region Name', json_data.get('Amazon Pinpoint')[0])
        self.assertIsNotNone('Endpoint', json_data.get('Amazon Pinpoint')[0])
        self.assertIsNotNone('Protocol', json_data.get('Amazon Pinpoint')[0])
        self.assertIsNotNone('Region', json_data.get('Amazon Pinpoint')[0])
        self.assertIsNotNone('Region Name', json_data.get('Amazon Pinpoint')[0])
示例#2
0
 def test_parse_page_fail(self, mock_response):
     """test failed parse_page()."""
     with self.assertRaises(IOError):
         rmap.parse_page()