def test_get_unsubscribed_lists(self): self.mox.StubOutWithMock(SubscriberList, "get") SubscriberList.get(None, "3", None).AndReturn(SubscriberList(None)) self.mox.ReplayAll() lists = self.record.get_unsubscribed_lists() self.assertEqual(1, len(lists)) self.assertTrue(isinstance(lists[0], SubscriberList)) self.mox.VerifyAll()
def test_static_get(self): context = self.mox.CreateMockAnything() context.make_request("list", "GET", record_id=1, parameters={"sort": "id", "order": "asc"}).AndReturn( json.dumps([{"id": 1}])) self.mox.ReplayAll() record = SubscriberList.get(context, 1, {"sort": "id", "order": "asc"}) self.assertTrue(isinstance(record, SubscriberList)) self.assertEqual({"id": 1}, record.backing) self.mox.VerifyAll()
def test_static_get(self): context = self.mox.CreateMockAnything() context.make_request("list", "GET", record_id=1, parameters={ "sort": "id", "order": "asc" }).AndReturn(json.dumps([{ "id": 1 }])) self.mox.ReplayAll() record = SubscriberList.get(context, 1, {"sort": "id", "order": "asc"}) self.assertTrue(isinstance(record, SubscriberList)) self.assertEqual({"id": 1}, record.backing) self.mox.VerifyAll()