Ejemplo n.º 1
0
    def test_update_region_mapping_fail(self, mock_response, mock_accessor):
        """test sucessful update_region_mapping()"""
        mock_common_accessor = mock_accessor().__enter__()
        mock_response.return_value = MockResponse(self.test_data, 200)
        mock_common_accessor.add.side_effect = IntegrityError('fake', 'fake', 'fake')

        expected = 'WARNING:masu.util.aws.region_map:Duplicate entry in DB: "us-east-1" - "US East (N. Virginia)"'

        logging.disable(logging.NOTSET)
        with self.assertLogs('masu.util.aws.region_map', level='WARNING') as logger:
            rmap.update_region_mapping()
            self.assertIn(expected, logger.output)
Ejemplo n.º 2
0
 def test_update_region_mapping_success(self, mock_response, mock_accessor):
     """test sucessful update_region_mapping()"""
     mock_common_accessor = mock_accessor().__enter__()
     mock_response.return_value = MockResponse(self.test_data, 200)
     response = rmap.update_region_mapping()
     self.assertEqual(str(response), 'True')
     mock_common_accessor.add.assert_called()
Ejemplo n.º 3
0
def update_region_map():
    """Return download file async task ID."""
    return jsonify(update_region_mapping())
Ejemplo n.º 4
0
def update_region_map(request):
    """Return download file async task ID."""
    return Response(update_region_mapping())