def test_get_valid_owner_apikey(): with patch.object(ConfigParser.ConfigParser, 'get', return_value=ID_WITH_VALID_LENGTH): owner_api_key = api_utils.get_owner_apikey() assert owner_api_key == ID_WITH_VALID_LENGTH
def test_get_invalid_owner_apikey(capsys): with patch.object(ConfigParser.ConfigParser, 'get', return_value=ID_WITH_INVALID_LENGTH): with pytest.raises(SystemExit): api_utils.load_config = Mock() result = api_utils.get_owner_apikey() out, err = capsys.readouterr() assert result is None assert ID_WITH_INVALID_LENGTH in out assert 'is not of correct length' in out
def test_get_invalid_owner_apikey(capsys): with patch.object(ConfigParser.ConfigParser, 'get', return_value=ID_WITH_INVALID_LENGTH): with pytest.raises(SystemExit): api_utils.load_config = Mock() result = api_utils.get_owner_apikey() out, err = capsys.readouterr() assert result is None assert ID_WITH_INVALID_LENGTH in out assert 'is not of correct length' in out
def test_get_valid_owner_apikey(): with patch.object(ConfigParser.ConfigParser, 'get', return_value=ID_WITH_VALID_LENGTH): owner_api_key = api_utils.get_owner_apikey() assert owner_api_key == ID_WITH_VALID_LENGTH