Check that the challenge resource we got is the one we expected.
339015
def _check_challenge(cls, challenge, challenge_body):
        
        if challenge.uri != challenge_body.uri:
            raise errors.UnexpectedUpdate(challenge.uri)
        return challenge
47101
def IS(instance, other):  # noqa
    
    try:
        instance = instance._redpipe_future_result  # noqa
    except AttributeError:
        pass

    try:
        other = other._redpipe_future_result
    except AttributeError:
        pass

    return instance is other
506012
protected function ensureNotEmpty() {
        $this->currentInstance = 0;
        while ($this->resourceIterator->valid() && !$this->load($this->resourceIterator->current(), 0)) {
            $this->resourceIterator->next();
        }
    }
357654
def check(self, request, consumer, token, signature):
        """"""
        built = self.sign(request, consumer, token)
        return built == signature
276992
def handle_challenge(self,data):
        
        # Send challenge response
        self.send_message(AUTHENTICATE(
            signature = self.password,
            extra = {}
        ))
947129
def verify(self, dataset, publication_date, source, refernce_url):
        """"""

        path = '/api/1.0/meta/verifydataset'
        req = definition.DatasetVerifyRequest(dataset, publication_date, source, refernce_url)
        result = self._api_post(definition.DatasetVerifyResponse, path, req)
        if result.status == 'failed':
            ver_err = '\r\n'.join(result.errors)
            msg = 'Dataset has not been verified, because of the following error(s): {}'.format(ver_err)
            raise ValueError(msg)
318829
def challenge_record_valid?(domain, key)
      record = challenge_record(domain)
      return record && record.data == key
    end
1252011
def validate(self):
        """"""
        if not self._resource.get('permissions'):
            self.permissions = self.default_permissions

        try:
            # update _resource so have default values from the schema
            self._resource = self.schema(self._resource)
        except MultipleInvalid as e:
            errors = [format_error(err, self.resource_type) for err in e.errors]
            raise exceptions.ValidationError({'errors': errors})

        yield self.check_service()
        yield self.check_unique()
1305520
def assert_equal(expected, actual)
      return if expected == actual
      raise Failure.new("Equality Failure", expected, actual)
    end
71668
def verify(self, checksum=None, token=None, full_response=False):
        """"""
        payload = {"checksum":checksum, "a":"verify"}
        if token:
            payload.update({"token":token})
        return self.get_shards(Shard(**payload), full_response=True)
1037603
def ready_for_challenge(domain, dns_challenge)
      record = "#{dns_challenge.record_name}.#{domain}"
      challenge_value = dns_challenge.record_content
      txt_value = Resolv::DNS.open do |dns|
        records = dns.getresources(record, Resolv::DNS::Resource::IN::TXT);
        records.empty? ? nil : records.map(&:data).join(" ")
      end
      txt_value == challenge_value
    end
1333166
def _check_success(self):
        

        # remember objects that are on the correct pegs
        gripper_site_pos = self.sim.data.site_xpos[self.eef_site_id]
        for i in range(len(self.ob_inits)):
            obj_str = str(self.item_names[i]) + "0"
            obj_pos = self.sim.data.body_xpos[self.obj_body_id[obj_str]]
            dist = np.linalg.norm(gripper_site_pos - obj_pos)
            r_reach = 1 - np.tanh(10.0 * dist)
            self.objects_on_pegs[i] = int(self.on_peg(obj_pos, i) and r_reach < 0.6)

        if self.single_object_mode > 0:
            return np.sum(self.objects_on_pegs) > 0  # need one object on peg

        # returns True if all objects are on correct pegs
        return np.sum(self.objects_on_pegs) == len(self.ob_inits)
1256810
def determineFrom(cls, challenge, password):
        
        nonce = secureRandom(16)
        response = _calcResponse(challenge, nonce, password)
        return dict(cnonce=nonce, response=response)
946689
def evaluate(actual, expected)
      if expected == actual
        pass new_message.is_equal_to(expected)
      else
        fail expected_message(expected).not(actual)
      end
    end
1175041
def asserts(self, *args, **kwargs):
        
        result = self.match(*args, **kwargs)
        self.expect(result)
        return result
200509
def check(self, pointer, expected, raise_onerror=False):
        
        obj = self.document
        for token in Pointer(pointer):
            try:
                obj = token.extract(obj, bypass_ref=True)
            except ExtractError as error:
                if raise_onerror:
                    raise Error(*error.args)
                logger.exception(error)
                return False
        return obj == expected
127985
def _verify_page(self):
        """"""
        title_date = self._get_date_in_title().lower()
        split_date = self.date.lower().split()
        split_date[0] = split_date[0][:3]
        return all(term in title_date for term in split_date)