Esempio n. 1
0
    def test_vpsas_empty_list(self):
        httpretty.register_uri(httpretty.GET,
                               '%s/api/vpsas.json' % rest_service_url,
                               body='{ "error": "vpsa not found" }')

        response = VpsaEndpoint.vpsas(self.c)
        response.should.be.empty
    def test_vpsas_empty_list(self):
        httpretty.register_uri(
            httpretty.GET, "%s/api/vpsas.json" % rest_service_url, body='{ "error": "vpsa not found" }'
        )

        response = VpsaEndpoint.vpsas(self.c)
        response.should.be.empty
Esempio n. 3
0
    def test_vpsas_list(self):
        httpretty.register_uri(httpretty.GET,
                               '%s/api/vpsas.json' % rest_service_url,
                               body=get_json_vpsa_list_response(3))

        response = VpsaEndpoint.vpsas(self.c)
        len(response).should.be.equal(3)
        response[2].keys().should.contain('name')
        response[2]['name'].should_not.be.different_of('this_vpsa_2')
    def test_vpsas_list(self):
        httpretty.register_uri(
            httpretty.GET, "%s/api/vpsas.json" % rest_service_url, body=get_json_vpsa_list_response(3)
        )

        response = VpsaEndpoint.vpsas(self.c)
        len(response).should.be.equal(3)
        response[2].keys().should.contain("name")
        response[2]["name"].should_not.be.different_of("this_vpsa_2")
Esempio n. 5
0
    def test_restore_vpsa(self):
        httpretty.register_uri(httpretty.POST,
                               '%s/api/vpsas/1234/restore.json' %
                               rest_service_url,
                               body='''{
                    "response": "VPSA restoring."
                    }''')

        response = VpsaEndpoint.restore(self.c, 1234)
        response.should.contain('restoring')
Esempio n. 6
0
    def test_hibernate_vpsa(self):
        httpretty.register_uri(httpretty.POST,
                               '%s/api/vpsas/1234/hibernate.json' %
                               rest_service_url,
                               body='''{
                    "response": "VPSA being put into hibernating state."
                    }''')

        response = VpsaEndpoint.hibernate(self.c, 1234)
        response.should.contain('being put into hibernating state')
Esempio n. 7
0
    def test_vpsa_per_id(self):
        vpsa_id = 3456
        httpretty.register_uri(httpretty.GET,
                               '%s/api/vpsas/%d.json' %
                               (rest_service_url, vpsa_id),
                               body=get_json_vpsa_response(vpsa_id=vpsa_id))

        response = VpsaEndpoint.vpsa(self.c, vpsa_id)
        response.keys().should.contain('name')
        response['name'].should_not.be.different_of('this_vpsa')
    def test_restore_vpsa(self):
        httpretty.register_uri(
            httpretty.POST,
            "%s/api/vpsas/1234/restore.json" % rest_service_url,
            body="""{
                    "response": "VPSA restoring."
                    }""",
        )

        response = VpsaEndpoint.restore(self.c, 1234)
        response.should.contain("restoring")
    def test_hibernate_vpsa(self):
        httpretty.register_uri(
            httpretty.POST,
            "%s/api/vpsas/1234/hibernate.json" % rest_service_url,
            body="""{
                    "response": "VPSA being put into hibernating state."
                    }""",
        )

        response = VpsaEndpoint.hibernate(self.c, 1234)
        response.should.contain("being put into hibernating state")
    def test_vpsa_per_id(self):
        vpsa_id = 3456
        httpretty.register_uri(
            httpretty.GET,
            "%s/api/vpsas/%d.json" % (rest_service_url, vpsa_id),
            body=get_json_vpsa_response(vpsa_id=vpsa_id),
        )

        response = VpsaEndpoint.vpsa(self.c, vpsa_id)
        response.keys().should.contain("name")
        response["name"].should_not.be.different_of("this_vpsa")