Exemple #1
0
 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(
         sc_messages.Operation.LabelsValue, {
             u'key1': u'value1',
             u'key2': u'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, {
             u'key1': u'value1',
             u'key2': u'value2'})
     with_labels = check_request.sign(self.test_check_request)
     expect(with_labels).not_to(equal(without_labels))
Exemple #3
0
 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=u'a_float',
                                 metricValues=[
                                     metric_value.create(
                                         labels={
                                             u'key1': u'value1',
                                             u'key2': u'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=u'a_float',
             metricValues=[
                 metric_value.create(
                     labels={
                         u'key1': u'value1',
                         u'key2': u'value2'},
                     doubleValue=1.1,
                 ),
             ]
         )
     ]
     with_mvs = check_request.sign(self.test_check_request)
     expect(with_mvs).not_to(equal(without_mvs))
Exemple #5
0
 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))
Exemple #6
0
 def test_should_sign_a_valid_check_request(self):
     check_request.sign(self.test_check_request)
Exemple #7
0
 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))
Exemple #8
0
 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))
Exemple #9
0
 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))
Exemple #10
0
 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))