def test_should_change_signature_when_labels_are_added(self): without_labels = check_request.sign(self.test_check_request) self.test_op.labels = encoding.PyValueToMessage( messages.Operation.LabelsValue, { 'key1': 'value1', 'key2': 'value2' }) with_labels = check_request.sign(self.test_check_request) expect(with_labels).not_to(equal(without_labels))
def test_should_change_signature_when_labels_are_added(self): without_labels = check_request.sign(self.test_check_request) self.test_op.labels = encoding.PyValueToMessage( messages.Operation.LabelsValue, { 'key1': 'value1', 'key2': 'value2' }) with_labels = check_request.sign(self.test_check_request) expect(with_labels).not_to(equal(without_labels))
def test_should_change_signature_when_metric_values_are_added(self): without_mvs = check_request.sign(self.test_check_request) self.test_op.metricValueSets = [ messages.MetricValueSet(metricName='a_float', metricValues=[ metric_value.create( labels={ 'key1': 'value1', 'key2': 'value2' }, doubleValue=1.1, ), ]) ] with_mvs = check_request.sign(self.test_check_request) expect(with_mvs).not_to(equal(without_mvs))
def test_should_change_signature_when_metric_values_are_added(self): without_mvs = check_request.sign(self.test_check_request) self.test_op.metricValueSets = [ messages.MetricValueSet( metricName='a_float', metricValues=[ metric_value.create( labels={ 'key1': 'value1', 'key2': 'value2' }, doubleValue=1.1, ), ] ) ] with_mvs = check_request.sign(self.test_check_request) expect(with_mvs).not_to(equal(without_mvs))
def test_should_change_signature_quota_properties_are_specified(self): without_qprops = check_request.sign(self.test_check_request) self.test_op.quotaProperties = messages.QuotaProperties() with_qprops = check_request.sign(self.test_check_request) expect(with_qprops).not_to(equal(without_qprops))
def test_should_sign_a_valid_check_request(self): check_request.sign(self.test_check_request)
def test_should_fail_if_operation_has_no_consumer_id(self): op = messages.Operation(operationName=_TEST_OP_NAME) testf = lambda: check_request.sign(messages.CheckRequest(operation=op)) expect(testf).to(raise_error(ValueError))
def test_should_fail_if_operation_has_no_operation_name(self): op = messages.Operation(consumerId=_TEST_CONSUMER_ID) testf = lambda: check_request.sign(messages.CheckRequest(operation=op)) expect(testf).to(raise_error(ValueError))
def test_should_fail_on_invalid_input(self): testf = lambda: check_request.sign(None) expect(testf).to(raise_error(ValueError)) testf = lambda: check_request.sign(object()) expect(testf).to(raise_error(ValueError))
def test_should_fail_if_operation_is_not_set(self): testf = lambda: check_request.sign(messages.CheckRequest()) expect(testf).to(raise_error(ValueError))
def test_should_change_signature_quota_properties_are_specified(self): without_qprops = check_request.sign(self.test_check_request) self.test_op.quotaProperties = messages.QuotaProperties() with_qprops = check_request.sign(self.test_check_request) expect(with_qprops).not_to(equal(without_qprops))
def test_should_sign_a_valid_check_request(self): check_request.sign(self.test_check_request)
def test_should_fail_if_operation_has_no_consumer_id(self): op = messages.Operation(operationName=_TEST_OP_NAME) testf = lambda: check_request.sign(messages.CheckRequest(operation=op)) expect(testf).to(raise_error(ValueError))
def test_should_fail_if_operation_has_no_operation_name(self): op = messages.Operation(consumerId=_TEST_CONSUMER_ID) testf = lambda: check_request.sign(messages.CheckRequest(operation=op)) expect(testf).to(raise_error(ValueError))
def test_should_fail_on_invalid_input(self): testf = lambda: check_request.sign(None) expect(testf).to(raise_error(ValueError)) testf = lambda: check_request.sign(object()) expect(testf).to(raise_error(ValueError))
def test_should_fail_if_operation_is_not_set(self): testf = lambda: check_request.sign(messages.CheckRequest()) expect(testf).to(raise_error(ValueError))