def test_do_zone_transfer_scoped(self):

        target_project_id = TransferRequestClient.as_user('alt').tenant_id

        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data(
                                       target_project_id=target_project_id))

        self.assertEqual(resp.status, 201)

        resp, retrived_transfer_request = TransferRequestClient.\
            as_user('alt').get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)

        resp, transfer_accept = TransferAcceptClient.as_user('alt')\
            .post_transfer_accept(
                datagen.random_transfer_accept_data(
                    key=transfer_request.key,
                    zone_transfer_request_id=transfer_request.id
                ))
        self.assertEqual(resp.status, 201)

        client = ZoneClient.as_user('default')

        self._assert_exception(exceptions.NotFound, 'domain_not_found', 404,
                               client.get_zone, self.zone.id)

        resp, zone = ZoneClient.as_user('alt').get_zone(self.zone.id)

        self.assertEqual(resp.status, 200)
    def test_do_zone_transfer_scoped(self):

        target_project_id = TransferRequestClient.as_user('alt').tenant_id

        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data(
                                       target_project_id=target_project_id))

        self.assertEqual(resp.status, 201)

        resp, retrived_transfer_request = TransferRequestClient.\
            as_user('alt').get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)

        resp, transfer_accept = TransferAcceptClient.as_user('alt')\
            .post_transfer_accept(
                datagen.random_transfer_accept_data(
                    key=transfer_request.key,
                    zone_transfer_request_id=transfer_request.id
                ))
        self.assertEqual(resp.status, 201)

        client = ZoneClient.as_user('default')

        self._assert_exception(
            exceptions.NotFound, 'domain_not_found', 404,
            client.get_zone, self.zone.id)

        resp, zone = ZoneClient.as_user('alt').get_zone(self.zone.id)

        self.assertEqual(resp.status, 200)
예제 #3
0
    def test_create_zone_transfer_request_scoped(self):
        target_project_id = TransferRequestClient.as_user('alt').tenant_id
        post_model = datagen.random_transfer_request_data(
            target_project_id=target_project_id)
        fixture = self.useFixture(
            TransferRequestFixture(
                zone=self.zone,
                post_model=post_model,
                user='******',
                target_user='******',
            ))

        self.assertEqual(201, fixture.post_resp.status)
        self.assertEqual(self.zone.id, fixture.transfer_request.zone_id)
        # todo: the zone_name is null initially, but shows up on later gets
        # self.assertEqual(fixture.transfer_request.zone_name, self.zone.name)
        self.assertEqual(
            TransferRequestClient.as_user(fixture.user).tenant_id,
            fixture.transfer_request.project_id)
        self.assertEqual(target_project_id,
                         fixture.transfer_request.target_project_id)

        resp, transfer_request = TransferRequestClient.as_user('alt')\
            .get_transfer_request(fixture.transfer_request.id)

        self.assertEqual(200, resp.status)
    def test_view_zone_transfer_request_scoped(self):
        target_project_id = TransferRequestClient.as_user('admin').tenant_id

        post_model = datagen.random_transfer_request_data(
            target_project_id=target_project_id)
        fixture = self.useFixture(TransferRequestFixture(
            zone=self.zone,
            post_model=post_model,
            user='******',
            target_user='******',
        ))
        transfer_request = fixture.transfer_request

        self.assertEqual(transfer_request.target_project_id,
                         target_project_id)

        self._assert_exception(
            exceptions.NotFound, 'zone_transfer_request_not_found', 404,
            TransferRequestClient.as_user('alt').get_transfer_request,
            self.zone.id)

        resp, transfer_request = TransferRequestClient.as_user('admin')\
            .get_transfer_request(transfer_request.id)

        self.assertEqual(200, resp.status)
예제 #5
0
    def test_view_zone_transfer_request_scoped(self):
        target_project_id = TransferRequestClient.as_user('admin').tenant_id

        post_model = datagen.random_transfer_request_data(
            target_project_id=target_project_id)
        fixture = self.useFixture(
            TransferRequestFixture(
                zone=self.zone,
                post_model=post_model,
                user='******',
                target_user='******',
            ))
        transfer_request = fixture.transfer_request

        self.assertEqual(transfer_request.target_project_id, target_project_id)

        self._assert_exception(
            exceptions.NotFound, 'zone_transfer_request_not_found', 404,
            TransferRequestClient.as_user('alt').get_transfer_request,
            self.zone.id)

        resp, transfer_request = TransferRequestClient.as_user('admin')\
            .get_transfer_request(transfer_request.id)

        self.assertEqual(200, resp.status)
    def test_view_zone_transfer_request(self):
        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data())
        self.assertEqual(resp.status, 201)

        resp, transfer_request = TransferRequestClient.as_user('alt')\
            .get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)
        self.assertEqual(getattr(transfer_request, 'key', None), None)
    def test_view_zone_transfer_request(self):
        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data())
        self.assertEqual(resp.status, 201)

        resp, transfer_request = TransferRequestClient.as_user('alt')\
            .get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)
        self.assertEqual(getattr(transfer_request, 'key', None), None)
    def test_create_zone_transfer_request_scoped(self):

        target_project_id = TransferRequestClient.as_user('alt').tenant_id

        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data(
                                       target_project_id=target_project_id))
        self.assertEqual(resp.status, 201)
        self.assertEqual(transfer_request.target_project_id, target_project_id)

        resp, transfer_request = TransferRequestClient.as_user('alt')\
            .get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)
    def test_create_zone_transfer_request_scoped(self):

        target_project_id = TransferRequestClient.as_user('alt').tenant_id

        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data(
                                       target_project_id=target_project_id))
        self.assertEqual(resp.status, 201)
        self.assertEqual(transfer_request.target_project_id, target_project_id)

        resp, transfer_request = TransferRequestClient.as_user('alt')\
            .get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)
예제 #10
0
    def test_do_zone_transfer_scoped(self):
        target_project_id = TransferRequestClient.as_user('alt').tenant_id
        post_model = datagen.random_transfer_request_data(
            target_project_id=target_project_id)
        fixture = self.useFixture(
            TransferRequestFixture(
                zone=self.zone,
                post_model=post_model,
                user='******',
                target_user='******',
            ))
        transfer_request = fixture.transfer_request

        resp, retrived_transfer_request = TransferRequestClient.\
            as_user('alt').get_transfer_request(transfer_request.id)

        self.assertEqual(200, resp.status)

        resp, transfer_accept = TransferAcceptClient.as_user('alt')\
            .post_transfer_accept(
                datagen.random_transfer_accept_data(
                    key=transfer_request.key,
                    zone_transfer_request_id=transfer_request.id
                ))
        self.assertEqual(201, resp.status)

        client = ZoneClient.as_user('default')

        self._assert_exception(exceptions.NotFound, 'zone_not_found', 404,
                               client.get_zone, self.zone.id)

        resp, zone = ZoneClient.as_user('alt').get_zone(self.zone.id)

        self.assertEqual(200, resp.status)
 def test_create_zone_transfer_request_no_body(self):
     client = TransferRequestClient.as_user('default')
     resp, transfer_request = client \
         .post_transfer_request_empty_body(self.zone.id)
     self.assertEqual(201, resp.status)
     self.addCleanup(TransferRequestFixture.cleanup_transfer_request,
                     client, transfer_request.id)
예제 #12
0
 def test_create_zone_transfer_request_no_body(self):
     client = TransferRequestClient.as_user('default')
     resp, transfer_request = client \
         .post_transfer_request_empty_body(self.zone.id)
     self.assertEqual(201, resp.status)
     self.addCleanup(TransferRequestFixture.cleanup_transfer_request,
                     client, transfer_request.id)
    def test_do_zone_transfer_scoped(self):
        target_project_id = TransferRequestClient.as_user('alt').tenant_id
        post_model = datagen.random_transfer_request_data(
            target_project_id=target_project_id)
        fixture = self.useFixture(TransferRequestFixture(
            zone=self.zone,
            post_model=post_model,
            user='******',
            target_user='******',
        ))
        transfer_request = fixture.transfer_request

        resp, retrived_transfer_request = TransferRequestClient.\
            as_user('alt').get_transfer_request(transfer_request.id)

        self.assertEqual(200, resp.status)

        resp, transfer_accept = TransferAcceptClient.as_user('alt')\
            .post_transfer_accept(
                datagen.random_transfer_accept_data(
                    key=transfer_request.key,
                    zone_transfer_request_id=transfer_request.id
                ))
        self.assertEqual(201, resp.status)

        client = ZoneClient.as_user('default')

        self._assert_exception(
            exceptions.NotFound, 'domain_not_found', 404,
            client.get_zone, self.zone.id)

        resp, zone = ZoneClient.as_user('alt').get_zone(self.zone.id)

        self.assertEqual(200, resp.status)
    def test_create_zone_transfer_request(self):
        fixture = self.useFixture(TransferRequestFixture(
            zone=self.zone,
            post_model=datagen.random_transfer_request_data(),
        ))
        self.assertEqual(201, fixture.post_resp.status)
        self.assertEqual(self.zone.id, fixture.transfer_request.zone_id)
        # todo: this fails. the zone_name is null in the POST's response, but
        #       it's filled in on a subsequent get
        # self.assertEqual(self.zone.name, fixture.transfer_request.zone_name)
        self.assertEqual(TransferRequestClient.as_user(fixture.user).tenant_id,
                         fixture.transfer_request.project_id)
        self.assertEqual(fixture.transfer_request.target_project_id, None)

        # check that the zone_name is filled in
        resp, transfer_request = TransferRequestClient.as_user(fixture.user) \
            .get_transfer_request(fixture.transfer_request.id)
        self.assertEqual(self.zone.name, transfer_request.zone_name)
 def test_list_transfer_requests(self):
     self.useFixture(TransferRequestFixture(
         zone=self.zone,
         post_model=datagen.random_transfer_request_data(),
     ))
     resp, model = TransferRequestClient.as_user('default') \
         .list_transfer_requests()
     self.assertEqual(200, resp.status)
     self.assertGreater(len(model.transfer_requests), 0)
예제 #16
0
    def test_create_zone_transfer_request(self):
        fixture = self.useFixture(
            TransferRequestFixture(
                zone=self.zone,
                post_model=datagen.random_transfer_request_data(),
            ))
        self.assertEqual(fixture.post_resp.status, 201)
        self.assertEqual(fixture.transfer_request.zone_id, self.zone.id)
        # todo: this fails. the zone_name is null in the POST's response, but
        #       it's filled in on a subsequent get
        # self.assertEqual(fixture.transfer_request.zone_name, self.zone.name)
        self.assertEqual(fixture.transfer_request.project_id,
                         TransferRequestClient.as_user(fixture.user).tenant_id)
        self.assertEqual(fixture.transfer_request.target_project_id, None)

        # check that the zone_name is filled in
        resp, transfer_request = TransferRequestClient.as_user(fixture.user) \
            .get_transfer_request(fixture.transfer_request.id)
        self.assertEqual(transfer_request.zone_name, self.zone.name)
    def test_view_zone_transfer_request_scoped(self):
        target_project_id = TransferRequestClient.as_user('admin').tenant_id

        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data(
                                       target_project_id=target_project_id))
        self.assertEqual(resp.status, 201)
        self.assertEqual(transfer_request.target_project_id, target_project_id)

        self._assert_exception(
            exceptions.NotFound, 'zone_transfer_request_not_found', 404,
            TransferRequestClient.as_user('alt').get_transfer_request,
            self.zone.id)

        resp, transfer_request = TransferRequestClient.as_user('admin')\
            .get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)
    def test_view_zone_transfer_request_scoped(self):
        target_project_id = TransferRequestClient.as_user('admin').tenant_id

        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data(
                                       target_project_id=target_project_id))
        self.assertEqual(resp.status, 201)
        self.assertEqual(transfer_request.target_project_id, target_project_id)

        self._assert_exception(
            exceptions.NotFound, 'zone_transfer_request_not_found', 404,
            TransferRequestClient.as_user('alt').get_transfer_request,
            self.zone.id)

        resp, transfer_request = TransferRequestClient.as_user('admin')\
            .get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)
예제 #19
0
 def test_list_transfer_requests(self):
     self.useFixture(
         TransferRequestFixture(
             zone=self.zone,
             post_model=datagen.random_transfer_request_data(),
         ))
     resp, model = TransferRequestClient.as_user('default') \
         .list_transfer_requests()
     self.assertEqual(200, resp.status)
     self.assertGreater(len(model.transfer_requests), 0)
    def test_view_zone_transfer_request(self):
        fixture = self.useFixture(TransferRequestFixture(
            zone=self.zone,
            post_model=datagen.random_transfer_request_data(),
        ))

        resp, transfer_request = TransferRequestClient.as_user('alt')\
            .get_transfer_request(fixture.transfer_request.id)

        self.assertEqual(resp.status, 200)
        self.assertEqual(getattr(transfer_request, 'key', None), None)
예제 #21
0
 def _create_transfer_request(self):
     client = TransferRequestClient.as_user(self.user)
     self.post_resp, self.transfer_request = client \
         .post_transfer_request(self.zone.id, self.post_model)
     assert self.post_resp.status == 201
     self.addCleanup(self.cleanup_transfer_request, client,
                     self.transfer_request.id)
     self.addCleanup(ZoneFixture.cleanup_zone,
                     ZoneClient.as_user(self.user), self.zone.id)
     self.addCleanup(ZoneFixture.cleanup_zone,
                     ZoneClient.as_user(self.target_user), self.zone.id)
예제 #22
0
 def _create_transfer_request(self):
     client = TransferRequestClient.as_user(self.user)
     self.post_resp, self.transfer_request = client \
         .post_transfer_request(self.zone.id, self.post_model)
     assert self.post_resp.status == 201
     self.addCleanup(self.cleanup_transfer_request, client,
                     self.transfer_request.id)
     self.addCleanup(ZoneFixture.cleanup_zone,
                     ZoneClient.as_user(self.user), self.zone.id)
     self.addCleanup(ZoneFixture.cleanup_zone,
                     ZoneClient.as_user(self.target_user), self.zone.id)
예제 #23
0
    def test_view_zone_transfer_request(self):
        fixture = self.useFixture(
            TransferRequestFixture(
                zone=self.zone,
                post_model=datagen.random_transfer_request_data(),
            ))

        resp, transfer_request = TransferRequestClient.as_user('alt')\
            .get_transfer_request(fixture.transfer_request.id)

        self.assertEqual(resp.status, 200)
        self.assertIsNone(getattr(transfer_request, 'key', None))
    def test_do_zone_transfer(self):
        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data())
        self.assertEqual(resp.status, 201)

        resp, transfer_accept = TransferAcceptClient.as_user('alt')\
            .post_transfer_accept(
                datagen.random_transfer_accept_data(
                    key=transfer_request.key,
                    zone_transfer_request_id=transfer_request.id
                ))
        self.assertEqual(resp.status, 201)
    def test_do_zone_transfer(self):
        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data())
        self.assertEqual(resp.status, 201)

        resp, transfer_accept = TransferAcceptClient.as_user('alt')\
            .post_transfer_accept(
                datagen.random_transfer_accept_data(
                    key=transfer_request.key,
                    zone_transfer_request_id=transfer_request.id
                ))
        self.assertEqual(resp.status, 201)
    def test_create_zone_transfer_request_scoped(self):
        target_project_id = TransferRequestClient.as_user('alt').tenant_id
        post_model = datagen.random_transfer_request_data(
            target_project_id=target_project_id)
        fixture = self.useFixture(TransferRequestFixture(
            zone=self.zone,
            post_model=post_model,
            user='******',
            target_user='******',
        ))

        self.assertEqual(201, fixture.post_resp.status)
        self.assertEqual(self.zone.id, fixture.transfer_request.zone_id)
        # todo: the zone_name is null initially, but shows up on later gets
        # self.assertEqual(fixture.transfer_request.zone_name, self.zone.name)
        self.assertEqual(TransferRequestClient.as_user(fixture.user).tenant_id,
                         fixture.transfer_request.project_id)
        self.assertEqual(target_project_id,
                         fixture.transfer_request.target_project_id)

        resp, transfer_request = TransferRequestClient.as_user('alt')\
            .get_transfer_request(fixture.transfer_request.id)

        self.assertEqual(200, resp.status)
 def test_list_transfer_requests(self):
     resp, model = TransferRequestClient.as_user('default') \
         .list_transfer_requests()
     self.assertEqual(resp.status, 200)
 def test_create_zone_transfer_request(self):
     resp, transfer_request = TransferRequestClient.as_user('default')\
         .post_transfer_request(self.zone.id,
                                datagen.random_transfer_request_data())
     self.assertEqual(resp.status, 201)
 def test_create_zone_transfer_request_no_body(self):
     resp, transfer_request = TransferRequestClient.as_user('default')\
         .post_transfer_request_empty_body(self.zone.id)
     self.assertEqual(resp.status, 201)
 def test_list_transfer_requests(self):
     resp, model = TransferRequestClient.as_user('default') \
         .list_transfer_requests()
     self.assertEqual(resp.status, 200)
 def test_create_zone_transfer_request(self):
     resp, transfer_request = TransferRequestClient.as_user('default')\
         .post_transfer_request(self.zone.id,
                                datagen.random_transfer_request_data())
     self.assertEqual(resp.status, 201)
 def test_create_zone_transfer_request_no_body(self):
     resp, transfer_request = TransferRequestClient.as_user('default')\
         .post_transfer_request_empty_body(self.zone.id)
     self.assertEqual(resp.status, 201)