

def test_create_w_alternate_client(self):
    from gcloud.dns.resource_record_set import ResourceRecordSet
    self._setUpConstants()
    RESOURCE = self._makeResource()
    PATH = ('projects/%s/managedZones/%s/changes' % (self.PROJECT, self.ZONE_NAME))
    conn1 = _Connection()
    client1 = _Client(project=self.PROJECT, connection=conn1)
    conn2 = _Connection(RESOURCE)
    client2 = _Client(project=self.PROJECT, connection=conn2)
    zone = _Zone(client1)
    changes = self._makeOne(zone)
    changes.add_record_set(ResourceRecordSet('test.example.com', 'CNAME', 3600, ['www.example.com'], zone))
    changes.delete_record_set(ResourceRecordSet('test.example.com', 'CNAME', 86400, ['other.example.com'], zone))
    changes.create(client=client2)
    self.assertEqual(len(conn1._requested), 0)
    self.assertEqual(len(conn2._requested), 1)
    req = conn2._requested[0]
    self.assertEqual(req['method'], 'POST')
    self.assertEqual(req['path'], ('/%s' % PATH))
    SENT = {
        'additions': RESOURCE['additions'],
        'deletions': RESOURCE['deletions'],
    }
    self.assertEqual(req['data'], SENT)
    self._verifyResourceProperties(PATH, RESOURCE, zone)

dataset/ETHPy150Open GoogleCloudPlatform/gcloud-python/gcloud/dns/test_changes.py TestChanges.test_create_w_alternate_client/VarMisuse@260/385 `changes`->`PATH`