예제 #1
0
 def test_should_not_raise_api_parameter_version_err_with_version_match(
         self):
     service = ServiceBase(api_version=9.0)
     assert_that(
         calling(service._check_method_version).with_args("aMethod", 9.0),
         not_(raises(ApiParameterVersionError))
     )
예제 #2
0
 def test_should_not_raise_api_method_version_err_with_empty_params(
         self):
     service = ServiceBase(api_version=9.0)
     assert_that(
         calling(service._check_param_versions).with_args("aMethod", []),
         not_(raises(ApiMethodVersionError))
     )
예제 #3
0
 def test_should_raise_api_method_version_err_with_no_params(self):
     service = ServiceBase(api_version=9.0, dispatcher=NoOpDispatcher)
     assert_that(
         calling(
             service.send_request
         ).with_args("aMethod", None, since=10.0),
         raises(ApiMethodVersionError)
     )
예제 #4
0
 def test_should_not_raise_api_parameter_version_err_with_matching_version(
         self):
     service = ServiceBase(api_version=9.0)
     assert_that(
         calling(service._check_param_versions).with_args(
             "aMethod", [("aParam", "aValue", 9.0, None)]),
         not_(raises(ApiParameterVersionError))
     )
예제 #5
0
 def test_should_raise_api_parameter_version_err_with_greater_version(self):
     service = ServiceBase(api_version=9.0)
     assert_that(
         calling(service._check_param_versions).with_args(
             "aMethod", [("aParam", "aValue", 10.0, None)]),
         raises(ApiParameterVersionError,
                ".*Invalid Parameters: \['aParam \(version: 10.0\)'\]"
                )
     )
 def test_should_pass_verify_ssl(self):
     service = ServiceBase(verify_ssl=False)
     self.assertFalse(service._dispatcher._verify_ssl)
 def test_should_pass_password_to_dispatcher(self):
     service = ServiceBase(mvip="127.0.0.1",
                           api_version=9.0,
                           password="******")
     self.assertTrue("fake_password" in service._dispatcher._password)
 def test_should_default_verify_ssl_to_True(self):
     service = ServiceBase()
     self.assertTrue(service._dispatcher._verify_ssl)
 def test_should_construct_endpoint(self):
     service = ServiceBase(mvip="127.0.0.1", api_version=9.0)
     self.assertEquals(service._dispatcher._endpoint, "https://127.0.0.1/json-rpc/9.0")
 def test_should_pass_username_to_dispatcher(self):
     service = ServiceBase(mvip="127.0.0.1",
                           api_version=9.0,
                           username="******")
     self.assertTrue("fake_username" in service._dispatcher._username)
 def test_should_map_api_version(self):
     service = ServiceBase(api_version=9.0)
     self.assertEquals(service._api_version, 9.0)
 def test_endpoint_should_be_secure(self):
     service = ServiceBase()
     self.assertTrue("https" in service._dispatcher._endpoint)
예제 #13
0
 def test_should_default_api_version_to_8(self):
     service = ServiceBase()
     assert_that(service._api_version, equal_to(8.0))
 def test_should_default_api_version_to_8(self):
     service = ServiceBase()
     self.assertEquals(service._api_version, 8.0)
예제 #15
0
 def test_should_pass_verify_ssl(self):
     service = ServiceBase(verify_ssl=False)
     assert_that(service._dispatcher._verify_ssl, is_(False))
    def test_should_raise_api_method_version_err(self):
        service = ServiceBase(api_version=9.0)

        with self.assertRaises(ApiMethodVersionError) as context:
            service._check_method_version("aMethod", 10.0)
예제 #17
0
 def test_should_default_verify_ssl_to_True(self):
     service = ServiceBase()
     assert_that(service._dispatcher._verify_ssl, is_(True))
예제 #18
0
 def test_should_pass_password_to_dispatcher(self):
     service = ServiceBase(mvip="127.0.0.1",
                           api_version=9.0,
                           password="******")
     assert_that(service._dispatcher._credentials,
                 ends_with("fake_password"))
예제 #19
0
 def test_should_pass_username_to_dispatcher(self):
     service = ServiceBase(mvip="127.0.0.1",
                           api_version=9.0,
                           username="******")
     assert_that(service._dispatcher._credentials,
                 starts_with("fake_username"))
예제 #20
0
 def test_endpoint_should_be_secure(self):
     service = ServiceBase()
     assert_that(service._dispatcher._endpoint, starts_with("https"))
예제 #21
0
 def test_should_map_api_version(self):
     service = ServiceBase(api_version=9.0)
     assert_that(service._api_version, equal_to(9.0))
    def test_should_raise_api_method_version_err_with_no_params(self):
        service = ServiceBase(api_version=9.0, dispatcher=NoOpDispatcher)

        with self.assertRaises(ApiMethodVersionError) as context:
            service.send_request("aMethod", None, since=10.0)
예제 #23
0
 def test_should_raise_api_method_version_err(self):
     service = ServiceBase(api_version=9.0)
     assert_that(
         calling(service._check_method_version).with_args("aMethod", 10.0),
         raises(ApiMethodVersionError)
     )