def test_to_smaller_then_from(self): event = {'from': 100, 'to': 80} context = {} result = generate_pages_range_handler(event, context) assert 'errors' in result assert len(result['errors']) == 1 assert 'Expected to parameter bigger or equal from parameter, was from: 100 to: 80' in result['errors']
def test_from_parameter_smaller_then_0(self): event = {'from': -10, 'to': 11} context = {} result = generate_pages_range_handler(event, context) assert 'errors' in result assert len(result['errors']) == 1 assert 'Expected form parameter bigger then 0, was -10' in result['errors']
def test_from_parameter_not_a_number(self): event = {'from': '1b', 'to': 10} context = {} result = generate_pages_range_handler(event, context) assert 'errors' in result assert len(result['errors']) == 1 assert 'Expected form parameter as number, was 1b' in result['errors']
def test_missing_to_parameter(self): event = {'from': 10} context = {} result = generate_pages_range_handler(event, context) assert 'errors' in result assert len(result['errors']) == 1 assert 'Missing to parameter.' in result['errors']
def test_happy_path(self): event = {'from': 80, 'to': 100} context = {} result = generate_pages_range_handler(event, context) assert 'from' in result assert 'to' in result assert result['from']==80 assert result['to']==100
def test_no_parameters(self): event = {} context = {} result = generate_pages_range_handler(event, context) assert 'errors' in result assert len(result['errors']) == 2 assert 'Missing to parameter.' in result['errors'] assert 'Missing from parameter.' in result['errors']