def test_build_url(): full_url = build_url('insult', 'txt', language_code='en', who='Kristen', plural=True) expected_url = 'https://insult.mattbas.org/api/en/insult.txt?who=Kristen&plural=on' assert full_url == expected_url, "Should be '{}".format(expected_url)
def test_build_url_invalid_who(): with pytest.raises(ValueError): build_url('insult', 'json', language_code='en', who=7, plural=False)
def test_build_url_invalid_plural(): with pytest.raises(ValueError): build_url('insult', 'json', language_code='en', who='Mace Windu', plural='invalid')
def test_build_url_invalid_language_code(): with pytest.raises(ValueError): build_url('insult', 'json', language_code=3, who='The Avengers', plural=True)
def test_build_url_no_response_format(): with pytest.raises(ValueError): build_url('insult', '', language_code='en', who='Beyonce', plural=False)
def test_build_url_invalid_response_format(): with pytest.raises(ValueError): build_url('insult', 'invalid', language_code='en', who='Wakanda', plural=False)
def test_build_url_no_request_type(): with pytest.raises(ValueError): build_url('', 'txt', language_code='en', who='Kristen', plural=False)
def test_build_url_invalid_request_type(): with pytest.raises(ValueError): build_url('invalid', 'txt', language_code='en', who='Campbell', plural=False)