def test_status_of_non_existent_payment(self): gopay = given_client() non_existent_id = -10 status = gopay.get_status(non_existent_id) should_return_error( status, 500, {"scope": "G", "field": None, "error_code": 500, "error_name": None, "message": None, "description": None}, )
def test_status_of_non_existent_payment(self): gopay = given_client() non_existent_id = -10 status = gopay.get_status(non_existent_id) should_return_error( status, 500, { 'scope': 'G', 'field': None, 'error_code': 500, 'error_name': None, 'message': None, 'description': None })
def test_should_localize_error_messages(self, lang, expected_error): gopay = given_client({"language": lang, "clientSecret": "invalid secret"}) status = gopay.get_status("irrelevant id is never used because token is not retrieved") should_return_error( status, 403, { "scope": "G", "field": None, "error_code": 202, "error_name": "AUTH_WRONG_CREDENTIALS", "message": expected_error, "description": None, }, )
def test_should_localize_error_messages(self, lang, expected_error): gopay = given_client({ 'language': lang, 'clientSecret': 'invalid secret' }) status = gopay.get_status( 'irrelevant id is never used because token is not retrieved') should_return_error( status, 403, { 'scope': 'G', 'field': None, 'error_code': 202, 'error_name': 'AUTH_WRONG_CREDENTIALS', 'message': expected_error, 'description': None })
def test_create_payment_and_get_status(self): gopay = given_client() payment = gopay.create_payment({ 'amount': 1, 'currency': Currency.CZECH_CROWNS, 'order_number': 'order-test - ' + time.strftime("%Y-%m-%d %H:%M:%S"), 'order_description': 'python test', 'callback': { 'return_url': 'http://www.your-url.tld/return', 'notification_url': 'http://www.your-url.tld/notify' } }) should_return(payment, 'gw_url', contains_string('.gopay.')) id_payment = payment.json['id'] status = gopay.get_status(id_payment) should_return(status, 'state', is_(PaymentStatus.CREATED))
def test_create_payment_and_get_status(self): gopay = given_client() payment = gopay.create_payment({ 'amount': 1, 'currency': Currency.CZECH_CROWNS, 'order_number': 'order-test - ' + time.strftime("%Y-%m-%d %H:%M:%S"), 'order_description': 'python test', 'callback': { 'return_url': 'http://www.your-url.tld/return', 'notification_url': 'http://www.your-url.tld/notify' } }) should_return(payment, 'gw_url', contains_string('.gopay.')) id_payment = payment.json['id'] status = gopay.get_status(id_payment) should_return(status, 'state', is_(PaymentStatus.CREATED))
def test_create_payment_and_get_status(self): gopay = given_client() payment = gopay.create_payment({ "amount": 1, "currency": Currency.CZECH_CROWNS, "order_number": "order-test - " + time.strftime("%Y-%m-%d %H:%M:%S"), "order_description": "python test", "callback": { "return_url": "http://www.your-url.tld/return", "notification_url": "http://www.your-url.tld/notify", }, }) should_return(payment, "gw_url", contains_string(".gopay.")) id_payment = payment.json["id"] status = gopay.get_status(id_payment) should_return(status, "state", is_(PaymentStatus.CREATED))
def test_status_of_non_existent_payment(self): gopay = given_client() non_existent_id = -10 status = gopay.get_status(non_existent_id) should_return_error(status, 404)