def test_cancel(self):
        responses.add('DELETE', 'https://api.invoiced.com/subscriptions/123',
                      status=200,
                      json={"id": 123, "plan": "pro", "status": "canceled"})

        subscription = invoiced.Subscription(self.client, 123)
        self.assertTrue(subscription.cancel())
        self.assertEquals(subscription.status, "canceled")
    def test_update(self):
        responses.add('PATCH', 'https://api.invoiced.com/subscriptions/123',
                      status=200,
                      json={"id": 123, "plan": "pro"})

        subscription = invoiced.Subscription(self.client, 123)
        subscription.plan = "pro"
        self.assertTrue(subscription.save())

        self.assertEqual(subscription.plan, "pro")
 def test_update_no_params(self):
     subscription = invoiced.Subscription(self.client, 123)
     self.assertFalse(subscription.save())
 def test_endpoint(self):
     subscription = invoiced.Subscription(self.client, 123)
     self.assertEqual('/subscriptions/123', subscription.endpoint())