コード例 #1
0
 def test_set_admin_pw(self):
     #        HTTP/1.1 201 Created
     #        (no content)
     self.server.expect(method='GET', url='/api$').and_return(mime_type="application/json",
                                                              file_content=test_path + "Fusion_ping_virgin_response.json")
     self.server.expect(method='POST', url='/api$', data=json.dumps({"password": "******"})).and_return(
         reply_code=201)
     self.server.expect(method='GET', url='/api$').and_return(mime_type="application/json",
                                                              file_content=test_path + "Fusion_ping_established_response.json")
     f = Fusion(**fa)
     f.set_admin_password()
     f.ping()
コード例 #2
0
    def test_Set_admin_pw_again(self):
        #          HTTP/1.1 409 Conflict
        self.server.expect(method='GET', url='/api$').and_return(mime_type="application/json",
                                                                 file_content=test_path + "Fusion_ping_established_response.json")
        self.server.expect(method='POST', url='/api$', data=json.dumps({"password": "******"})).and_return(
            reply_code=409)

        f = Fusion(**fa)
        try:
            f.set_admin_password()
            self.fail("Should have had an exception")
        except fusionpy.FusionError as fe:
            self.assertEqual(409, fe.response.status)
コード例 #3
0
    def test_set_admin_pw_bad_pw(self):
        #        HTTP/1.1 400 Bad Request
        #        {"code":"invalid-password"}
        self.server.expect(method='GET', url='/api$').and_return(mime_type="application/json",
                                                                 file_content=test_path + "Fusion_ping_virgin_response.json")
        self.server.expect(method='POST', url='/api$', data=json.dumps({"password": "******"})).and_return(
            reply_code=400,
            content='{"code":"invalid-password"}')

        f = Fusion(**fa)
        try:
            f.set_admin_password("top_secret")
            self.fail("Should have had an exception")
        except fusionpy.FusionError as fe:
            self.assertTrue(fe.response.status == 400)
コード例 #4
0
ファイル: fusionpy_tests.py プロジェクト: ke4roh/fusionpy
 def test_set_admin_pw(self):
     #        HTTP/1.1 201 Created
     #        (no content)
     self.server.expect(method='GET', url='/api$').and_return(
         mime_type="application/json",
         file_content=test_path + "Fusion_ping_virgin_response.json")
     self.server.expect(method='POST',
                        url='/api$',
                        data=json.dumps({"password": "******"
                                         })).and_return(reply_code=201)
     self.server.expect(method='GET', url='/api$').and_return(
         mime_type="application/json",
         file_content=test_path + "Fusion_ping_established_response.json")
     f = Fusion(**fa)
     f.set_admin_password()
     f.ping()
コード例 #5
0
ファイル: fusionpy_tests.py プロジェクト: ke4roh/fusionpy
    def test_Set_admin_pw_again(self):
        #          HTTP/1.1 409 Conflict
        self.server.expect(method='GET', url='/api$').and_return(
            mime_type="application/json",
            file_content=test_path + "Fusion_ping_established_response.json")
        self.server.expect(method='POST',
                           url='/api$',
                           data=json.dumps({"password": "******"
                                            })).and_return(reply_code=409)

        f = Fusion(**fa)
        try:
            f.set_admin_password()
            self.fail("Should have had an exception")
        except fusionpy.FusionError as fe:
            self.assertEqual(409, fe.response.status)
コード例 #6
0
ファイル: fusionpy_tests.py プロジェクト: ke4roh/fusionpy
    def test_set_admin_pw_bad_pw(self):
        #        HTTP/1.1 400 Bad Request
        #        {"code":"invalid-password"}
        self.server.expect(method='GET', url='/api$').and_return(
            mime_type="application/json",
            file_content=test_path + "Fusion_ping_virgin_response.json")
        self.server.expect(method='POST',
                           url='/api$',
                           data=json.dumps(
                               {"password": "******"})).and_return(
                                   reply_code=400,
                                   content='{"code":"invalid-password"}')

        f = Fusion(**fa)
        try:
            f.set_admin_password("top_secret")
            self.fail("Should have had an exception")
        except fusionpy.FusionError as fe:
            self.assertTrue(fe.response.status == 400)