示例#1
0
def it_should_call_save_on_the_contact(mock_save):
    rf = helper.RequestFactory()
    mock_save.return_value = [{'status': '200'}, None]
    mock_request = rf.post('/notify/', dict(body=recurly_xml))
    response = notify(mock_request, settings.RECURLY_API_KEY)
    assert response.status_code == 200
    assert mock_save.called
示例#2
0
def it_errors_if_apikey_wrong():
    from recurly_parse_spec import recurly_successful_payment
    rf = helper.RequestFactory()
    mock_request = rf.post('/notify/',
      dict(body=recurly_successful_payment))
    response = notify(mock_request, "sdfsdfsd")
    assert response.status_code == 403
示例#3
0
def it_should_call_save_on_the_invoice(mock_save):
    from recurly_parse_spec import recurly_successful_payment
    mock_save.return_value = [{'status': '200'}, None]
    rf = helper.RequestFactory()
    mock_request = rf.post('/notify/', dict(body=recurly_successful_payment))
    response = notify(mock_request, settings.RECURLY_API_KEY)
    assert response.status_code == 200
    assert mock_save.called
示例#4
0
def it_should_call_save_on_the_contact(mock_save):
    rf = helper.RequestFactory()
    mock_save.return_value = [{'status':'200'}, None]
    mock_request = rf.post('/notify/',
                           data=recurly_xml.strip(),
                           content_type='text/xml')
    response = notify(mock_request, settings.RECURLY_API_KEY)
    assert response.status_code == 200
    assert mock_save.called
示例#5
0
def it_should_call_save_on_the_invoice(mock_save):
    from recurly_parse_spec import recurly_successful_payment
    mock_save.return_value = [{'status':'200'}, None]
    rf = helper.RequestFactory()
    mock_request = rf.post('/notify/',
                           data=recurly_successful_payment.strip(),
                           content_type='text/xml')
    response = notify(mock_request, settings.RECURLY_API_KEY)
    assert response.status_code == 200
    assert mock_save.called
示例#6
0
def it_should_pass_the_notification_to_the_notification_parser(mock_parse):
    class TestObject:
        def save(self):
            return [{'status': '200'}, None]

    rf = helper.RequestFactory()
    mock_parse.return_value = TestObject()
    mock_request = rf.post('/notify/', dict(body=recurly_xml))
    response = notify(mock_request, settings.RECURLY_API_KEY)
    assert response.status_code == 200
    assert mock_parse.called
示例#7
0
def it_should_pass_the_notification_to_the_notification_parser(mock_parse):
    class TestObject:
        def save(self):
            return [{'status':'200'}, None]

    rf = helper.RequestFactory()
    mock_parse.return_value = TestObject()
    mock_request = rf.post('/notify/', dict(body=recurly_xml))
    response = notify(mock_request, settings.RECURLY_API_KEY)
    assert response.status_code == 200
    assert mock_parse.called
示例#8
0
def it_errors_if_apikey_wrong():
    from recurly_parse_spec import recurly_successful_payment
    rf = helper.RequestFactory()
    mock_request = rf.post('/notify/', dict(body=recurly_successful_payment))
    response = notify(mock_request, "sdfsdfsd")
    assert response.status_code == 403