|  | @@ -19,7 +19,7 @@ def test_run_create_executes_and_calls_hooks_for_configured_repository():
 | 
	
		
			
				|  |  |          repository=None,
 | 
	
		
			
				|  |  |          progress=flexmock(),
 | 
	
		
			
				|  |  |          stats=flexmock(),
 | 
	
		
			
				|  |  | -        json=flexmock(),
 | 
	
		
			
				|  |  | +        json=False,
 | 
	
		
			
				|  |  |          list_files=flexmock(),
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  |      global_arguments = flexmock(monitoring_verbosity=1, dry_run=False, used_config_paths=[])
 | 
	
	
		
			
				|  | @@ -54,7 +54,7 @@ def test_run_create_with_store_config_files_false_does_not_create_borgmatic_mani
 | 
	
		
			
				|  |  |          repository=None,
 | 
	
		
			
				|  |  |          progress=flexmock(),
 | 
	
		
			
				|  |  |          stats=flexmock(),
 | 
	
		
			
				|  |  | -        json=flexmock(),
 | 
	
		
			
				|  |  | +        json=False,
 | 
	
		
			
				|  |  |          list_files=flexmock(),
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  |      global_arguments = flexmock(monitoring_verbosity=1, dry_run=False, used_config_paths=[])
 | 
	
	
		
			
				|  | @@ -91,7 +91,7 @@ def test_run_create_runs_with_selected_repository():
 | 
	
		
			
				|  |  |          repository=flexmock(),
 | 
	
		
			
				|  |  |          progress=flexmock(),
 | 
	
		
			
				|  |  |          stats=flexmock(),
 | 
	
		
			
				|  |  | -        json=flexmock(),
 | 
	
		
			
				|  |  | +        json=False,
 | 
	
		
			
				|  |  |          list_files=flexmock(),
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  |      global_arguments = flexmock(monitoring_verbosity=1, dry_run=False, used_config_paths=[])
 | 
	
	
		
			
				|  | @@ -123,7 +123,7 @@ def test_run_create_bails_if_repository_does_not_match():
 | 
	
		
			
				|  |  |          repository=flexmock(),
 | 
	
		
			
				|  |  |          progress=flexmock(),
 | 
	
		
			
				|  |  |          stats=flexmock(),
 | 
	
		
			
				|  |  | -        json=flexmock(),
 | 
	
		
			
				|  |  | +        json=False,
 | 
	
		
			
				|  |  |          list_files=flexmock(),
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  |      global_arguments = flexmock(monitoring_verbosity=1, dry_run=False, used_config_paths=[])
 | 
	
	
		
			
				|  | @@ -144,6 +144,47 @@ def test_run_create_bails_if_repository_does_not_match():
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +def test_run_create_produces_json():
 | 
	
		
			
				|  |  | +    flexmock(module.logger).answer = lambda message: None
 | 
	
		
			
				|  |  | +    flexmock(module.borgmatic.config.validate).should_receive(
 | 
	
		
			
				|  |  | +        'repositories_match'
 | 
	
		
			
				|  |  | +    ).once().and_return(True)
 | 
	
		
			
				|  |  | +    flexmock(module.borgmatic.borg.create).should_receive('create_archive').once().and_return(
 | 
	
		
			
				|  |  | +        flexmock()
 | 
	
		
			
				|  |  | +    )
 | 
	
		
			
				|  |  | +    parsed_json = flexmock()
 | 
	
		
			
				|  |  | +    flexmock(module.borgmatic.actions.json).should_receive('parse_json').and_return(parsed_json)
 | 
	
		
			
				|  |  | +    flexmock(module).should_receive('create_borgmatic_manifest').once()
 | 
	
		
			
				|  |  | +    flexmock(module.borgmatic.hooks.command).should_receive('execute_hook').times(2)
 | 
	
		
			
				|  |  | +    flexmock(module.borgmatic.hooks.dispatch).should_receive('call_hooks').and_return({})
 | 
	
		
			
				|  |  | +    flexmock(module.borgmatic.hooks.dispatch).should_receive(
 | 
	
		
			
				|  |  | +        'call_hooks_even_if_unconfigured'
 | 
	
		
			
				|  |  | +    ).and_return({})
 | 
	
		
			
				|  |  | +    create_arguments = flexmock(
 | 
	
		
			
				|  |  | +        repository=flexmock(),
 | 
	
		
			
				|  |  | +        progress=flexmock(),
 | 
	
		
			
				|  |  | +        stats=flexmock(),
 | 
	
		
			
				|  |  | +        json=True,
 | 
	
		
			
				|  |  | +        list_files=flexmock(),
 | 
	
		
			
				|  |  | +    )
 | 
	
		
			
				|  |  | +    global_arguments = flexmock(monitoring_verbosity=1, dry_run=False, used_config_paths=[])
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    assert list(
 | 
	
		
			
				|  |  | +        module.run_create(
 | 
	
		
			
				|  |  | +            config_filename='test.yaml',
 | 
	
		
			
				|  |  | +            repository={'path': 'repo'},
 | 
	
		
			
				|  |  | +            config={},
 | 
	
		
			
				|  |  | +            hook_context={},
 | 
	
		
			
				|  |  | +            local_borg_version=None,
 | 
	
		
			
				|  |  | +            create_arguments=create_arguments,
 | 
	
		
			
				|  |  | +            global_arguments=global_arguments,
 | 
	
		
			
				|  |  | +            dry_run_label='',
 | 
	
		
			
				|  |  | +            local_path=None,
 | 
	
		
			
				|  |  | +            remote_path=None,
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +    ) == [parsed_json]
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  def test_create_borgmatic_manifest_creates_manifest_file():
 | 
	
		
			
				|  |  |      flexmock(module.os.path).should_receive('join').with_args(
 | 
	
		
			
				|  |  |          module.borgmatic.borg.state.DEFAULT_BORGMATIC_SOURCE_DIRECTORY, 'bootstrap', 'manifest.json'
 |