예제 #1
0
def get_zk_meta_on_zkCli_sh(context, path, info):
    # zk_method : zk cmd means : ls ,get, rmr, set, config ... etc...you can run help on zkCli.sh for more info
    # /dble/cluster-1/conf/sharding
    # info is function name such as:enum_func
    # hostname is dble-1 ,dble-2,dble-3
    cmd = "cd {0}/bin && ./zkCli.sh get {1}|grep '{2}'".format(
        context.cfg_zookeeper['home'], path, info)
    # node = str(hostname)
    cmd_ssh = get_ssh("dble-1")
    rc, sto, ste = cmd_ssh.exec_command(cmd)
    func_name = []
    assert_that(sto, not_(empty()),
                "sto is not empty and it is : {0}".format(sto))
    LOGGER.debug("the sto is empty : {0}".format(sto))
    outcome_dict = json.loads(sto)
    LOGGER.debug(
        "add debug to check the result of executing {0} is :sto:{1}".format(
            cmd, outcome_dict))
    assert_that(
        outcome_dict, has_key("function"),
        "we have a key named function and they are:{0}".format(outcome_dict))
    LOGGER.debug("{0} function is : {1} ".format(path,
                                                 outcome_dict.get('function')))
    func_list = outcome_dict['function']
    for func_obj in func_list:
        if func_obj.get('name'):
            LOGGER.debug("{0} function is : {1} ".format(
                path, func_obj.get('name')))
            func_name.append(func_obj['name'])
        else:
            LOGGER.debug("there are no keys named name in {0} ".format(path))
    LOGGER.debug("we find function name are : {0}".format(func_name))
    return func_name
예제 #2
0
def step_impl(context):
    added_pet_json = context.requestConfigManager.get_response_full_json()
    has_key(RequestConstants.JSON_STATUS)
    assert_that(added_pet_json[RequestConstants.JSON_STATUS], equal_to(context.pet.status))
    has_key(RequestConstants.JSON_NAME)
    assert_that(added_pet_json[RequestConstants.JSON_NAME], equal_to(context.pet.name))
    has_key(RequestConstants.JSON_ID)
    assert_that(added_pet_json[RequestConstants.JSON_ID], equal_to(context.pet.pet_id))
    has_key(RequestConstants.JSON_PHOTOURLS)
    assert_that(added_pet_json[RequestConstants.JSON_PHOTOURLS], equal_to(context.pet.photourls))
예제 #3
0
def then_i_get_a_list_containing_the_following_cti_profiles(step):
    profile_response = world.response.data
    expected_profiles = _perform_casts(step.hashes)

    assert_that(profile_response, has_key('items'))
    profiles = profile_response['items']

    for expected_profile in expected_profiles:
        corresponding = _get_by_id(profiles, int(expected_profile['id']))
        assert_that(corresponding, not_none())
        assert_that(corresponding, has_entries(expected_profile))
 def testDescribeMismatch(self):
     self.assert_describe_mismatch("was 'bad'", has_key("a"), "bad")
 def testMismatchDescriptionShowsActualArgument(self):
     self.assert_mismatch_description("was 'bad'", has_key("a"), "bad")
 def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
     self.assert_no_mismatch_description(has_key("a"), {"a": 1})
 def testHasReadableDescription(self):
     self.assert_description("a dictionary containing key 'a'",
                             has_key("a"))
 def testMatchesAnyConformingDictionary(self):
     self.assert_matches("quasi-dictionary", has_key(1), QuasiDictionary())
     self.assert_does_not_match("non-dictionary", has_key(1), object())
 def testDoesNotMatchDictionaryMissingKey(self):
     dict = {"a": 1, "b": 2, "c": 3}
     self.assert_does_not_match("no matching key", has_key("d"), dict)
 def testDoesNotMatchEmptyDictionary(self):
     self.assert_does_not_match("empty", has_key("foo"), {})
 def testProvidesConvenientShortcutForMatchingWithEqualTo(self):
     dict = {"a": 1, "b": 2, "c": 3}
     self.assert_matches("Matches c", has_key("c"), dict)
 def testMatchesDictionaryContainingKey(self):
     dict = {"a": 1, "b": 2, "c": 3}
     self.assert_matches("Matches a", has_key(equal_to("a")), dict)
     self.assert_matches("Matches c", has_key(equal_to("c")), dict)
 def testMatchesSingletonDictionaryContainingKey(self):
     dict = {"a": 1}
     self.assert_matches("same single key", has_key(equal_to("a")), dict)