mirror of
				https://github.com/arcan1s/ahriman.git
				synced 2025-11-03 23:33:41 +00:00 
			
		
		
		
	* add models tests (#1) also replace single quote to double one to confort PEP docstring + move _check_output to class properties to make it available for mocking * alpm tests implementation * try to replace os with pathlib * update tests for pathlib * fix includes glob and trim version from dependencies * build_tools package tests * repository component tests * add sign tests * complete status tests * handle exceptions in actual_version calls * complete core tests * move configuration to root conftest * application tests * complete application tests * change copyright to more generic one * base web tests * complete web tests * complete testkit also add argument parsers test
		
			
				
	
	
		
			28 lines
		
	
	
		
			939 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			939 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import argparse
 | 
						|
 | 
						|
from pytest_mock import MockerFixture
 | 
						|
 | 
						|
from ahriman.application.handlers import Handler
 | 
						|
from ahriman.core.configuration import Configuration
 | 
						|
 | 
						|
 | 
						|
def test_call(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
 | 
						|
    """
 | 
						|
    must call inside lock
 | 
						|
    """
 | 
						|
    mocker.patch("ahriman.application.handlers.Handler.run")
 | 
						|
    enter_mock = mocker.patch("ahriman.application.lock.Lock.__enter__")
 | 
						|
    exit_mock = mocker.patch("ahriman.application.lock.Lock.__exit__")
 | 
						|
 | 
						|
    assert Handler._call(args, "x86_64", configuration)
 | 
						|
    enter_mock.assert_called_once()
 | 
						|
    exit_mock.assert_called_once()
 | 
						|
 | 
						|
 | 
						|
def test_call_exception(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
 | 
						|
    """
 | 
						|
    must process exception
 | 
						|
    """
 | 
						|
    mocker.patch("ahriman.application.lock.Lock.__enter__", side_effect=Exception())
 | 
						|
    assert not Handler._call(args, "x86_64", configuration)
 |