def test_create_or_update(self):
        context = self.mox.CreateMockAnything()
        context.make_request("subscriber",
                             "CREATEORUPDATE",
                             data=json.dumps([{
                                 "id": 1,
                                 "ref": "ref"
                             }])).AndReturn(
                                 json.dumps([{
                                     "id": 1,
                                     "ref": "ref"
                                 }]))
        self.mox.ReplayAll()

        record = Subscriber(context)
        record.backing = {"id": 1, "ref": "ref"}
        record.create_or_update()
        self.assertEqual("1", record.record_id)
        self.assertEqual("ref", record.ref)
        self.mox.VerifyAll()
 def setUp(self):
     mox.MoxTestBase.setUp(self)
     self.record = Subscriber(None)
     self.record.backing = {
         "id":
         1,
         "social_rating":
         2,
         "social_profile":
         3,
         "custom_fields": [{
             "field": "x",
             "data": "x"
         }],
         "lists": [{
             "list_id": 1,
             "unsubscribed": None,
             "option": "option"
         }, {
             "list_id": 3,
             "unsubscribed": "u",
             "option": "option"
         }]
     }