Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
Update invoice endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
siddick committed Apr 4, 2014
1 parent 2330891 commit ecd0ff6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion paypalrestsdk/invoices.py
Expand Up @@ -12,7 +12,7 @@ class Invoice(List, Find, Create, Delete, Update, Post):
>>> invoice = Invoice.new({})
>>> invoice.create() # return True or False
"""
path = "v1/invoices/invoice"
path = "v1/invoicing/invoices"

def send(self):
return self.post('send', {}, self)
Expand Down
18 changes: 9 additions & 9 deletions test/unit_tests/invoices_test.py
Expand Up @@ -30,22 +30,22 @@ def test_create(self, mock):
invoice = paypal.Invoice(self.invoice_attributes)
response = invoice.create()

mock.assert_called_once_with(invoice.api,'v1/invoices/invoice', self.invoice_attributes, {'PayPal-Request-Id' : invoice.request_id}, None)
mock.assert_called_once_with(invoice.api,'v1/invoicing/invoices', self.invoice_attributes, {'PayPal-Request-Id' : invoice.request_id}, None)
self.assertEqual(response, True)

@patch('test_helper.paypal.Api.get', autospec=True)
def test_find(self, mock):
invoice = paypal.Invoice.find(self.invoice.id)

mock.assert_called_once_with(self.invoice.api, 'v1/invoices/invoice/'+self.invoice.id)
mock.assert_called_once_with(self.invoice.api, 'v1/invoicing/invoices/'+self.invoice.id)
self.assertTrue(isinstance(invoice, paypal.Invoice))

@patch('test_helper.paypal.Api.get', autospec=True)
def test_all(self, mock):
mock.return_value = {'total_count': 1, 'invoices': [self.invoice_attributes]}
history = paypal.Invoice.all({'count': 1})

mock.assert_called_once_with(self.invoice.api, 'v1/invoices/invoice?count=1')
mock.assert_called_once_with(self.invoice.api, 'v1/invoicing/invoices?count=1')
self.assertEqual(history.total_count, 1)
self.assertTrue(isinstance(history.invoices[0], paypal.Invoice))

Expand All @@ -55,21 +55,21 @@ def test_all(self, mock):
def test_delete(self, mock):
response = self.invoice.delete()

mock.assert_called_once_with(self.invoice.api,'v1/invoices/invoice/'+self.invoice.id)
mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/'+self.invoice.id)
self.assertEqual(response, True)

@patch('test_helper.paypal.Api.put', autospec=True)
def test_update(self, mock):
response = self.invoice.update(self.invoice_attributes)

mock.assert_called_once_with(self.invoice.api,'v1/invoices/invoice/'+self.invoice.id, self.invoice_attributes, {'PayPal-Request-Id' : self.invoice.request_id}, None)
mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/'+self.invoice.id, self.invoice_attributes, {'PayPal-Request-Id' : self.invoice.request_id}, None)
self.assertEqual(response, True)

@patch('test_helper.paypal.Api.post', autospec=True)
def test_send(self, mock):
response = self.invoice.send()

mock.assert_called_once_with(self.invoice.api,'v1/invoices/invoice/'+self.invoice.id+'/send', {}, {'PayPal-Request-Id' : ANY})
mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/'+self.invoice.id+'/send', {}, {'PayPal-Request-Id' : ANY})
self.assertEqual(response, True)


Expand All @@ -86,7 +86,7 @@ def test_search(self, mock):

history = paypal.Invoice.search(search_attributes);

mock.assert_called_once_with(self.invoice.api,'v1/invoices/invoice/search', search_attributes)
mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/search', search_attributes)
self.assertEqual(history.total_count, 1)
self.assertTrue(isinstance(history.invoices[0], paypal.Invoice))

Expand All @@ -100,7 +100,7 @@ def test_remind(self, mock):

response = self.invoice.remind(remind_attributes);

mock.assert_called_once_with(self.invoice.api,'v1/invoices/invoice/'+self.invoice.id+'/remind', remind_attributes, {'PayPal-Request-Id' : ANY})
mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/'+self.invoice.id+'/remind', remind_attributes, {'PayPal-Request-Id' : ANY})
self.assertEqual(response, True)

@patch('test_helper.paypal.Api.post', autospec=True)
Expand All @@ -114,5 +114,5 @@ def test_cancel(self, mock):

response = self.invoice.cancel(cancel_attributes);

mock.assert_called_once_with(self.invoice.api,'v1/invoices/invoice/'+self.invoice.id+'/cancel', cancel_attributes, {'PayPal-Request-Id' : ANY})
mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/'+self.invoice.id+'/cancel', cancel_attributes, {'PayPal-Request-Id' : ANY})
self.assertEqual(response, True)

0 comments on commit ecd0ff6

Please sign in to comment.