def test_upload_loads_data_from_specified_directory(self, mock_exporter_class, mock_converter):
        mock_converter.return_value = {"foo": "bar"}

        cli._main(self.arguments)

        mock_converter.assert_called_once_with(
            {'my_account': {'id': '42', 'email': '*****@*****.**', 'owner': 'me'}})
    def test_upload_loads_data_from_specified_directory(
            self, mock_exporter_class, mock_converter):
        mock_converter.return_value = {"foo": "bar"}

        cli._main(self.arguments)

        mock_converter.assert_called_once_with({
            'my_account': {
                'id': '42',
                'email': '*****@*****.**',
                'owner': 'me'
            }
        })
    def test_upload_calls_all_upload_tasks(self, mock_exporter_class, mock_converter):
        """Mock away S3 Uploader, see if all necessary methods were called"""
        mock_converter.return_value = {"foo": "bar"}

        mock_exporter_instance = Mock()
        mock_exporter_class.return_value = mock_exporter_instance

        cli._main(self.arguments)

        mock_exporter_class.assert_called_once_with(
                "bucketname42",
                allowed_ips=["123", "345"],
                allowed_aws_account_ids=['42'])

        mock_exporter_instance.setup_infrastructure.assert_called_once_with()
        mock_exporter_instance.upload_to_S3.assert_called_once_with({'foo': 'bar'})
 def test_upload_uses_S3Uploader_correctly(self, _, mock_upload, mock_converter):
     """Check if the 'necessary methods' used above actually exist on S3Uploader"""
     upload_data = {"foo": "bar"}
     mock_converter.return_value = upload_data
     cli._main(self.arguments)
     mock_upload.assert_called_once_with(upload_data)