def test_schema_validation_fails_for_wrong_datatype(self): data = {'country': 1} request = request_factory.get_request( data=data, context_params={'crud_action': CrudActions.UPDATE_DETAIL}) response = self.validation.validate_request_data(request) assert_that(response.is_success, equal_to(False)) assert_that(response.data, has_item('country'))
def test_schema_validation_fails_for_wrong_datatype(self): data = { 'country': 1 } request = request_factory.get_request(data=data, context_params={ 'crud_action': CrudActions.UPDATE_DETAIL}) response = self.validation.validate_request_data(request) assert_that(response.is_success, equal_to(False)) assert_that(response.data, has_item('country'))
def then_the_cti_is_notified_for_a_configuration_change(step): expression = "xivo[cticonfig,update]" log_lines = logs.find_line_in_xivo_sysconfd_log() assert_that(log_lines, has_item(contains_string(expression)))
def testDescribeMismatch(self): self.assert_describe_mismatch("was <42>", has_item("a"), 42)
def testMismatchDescriptionShowsActualArgument(self): self.assert_mismatch_description("was <42>", has_item("a"), 42)
def testSuccessfulMatchDoesNotGenerateMismatchDescription(self): self.assert_no_mismatch_description(has_item("a"), self._sequence("a", "b"))
def testHasAReadableDescription(self): self.assert_description("a sequence containing 'a'", has_item("a"))
def testMatchesAnyConformingSequence(self): self.assert_matches("quasi-sequence", has_item(1), QuasiSequence()) self.assert_does_not_match("non-sequence", has_item(1), object())
def testProvidesConvenientShortcutForMatchingWithEqualTo(self): self.assert_matches("sequence contains 'a'", has_item("a"), self._sequence("a", "b", "c")) self.assert_does_not_match("sequence without 'a'", has_item("a"), self._sequence("b", "c"))
def testNoMatchIfSequenceDoesntContainAnElementMatchingTheGivenMatcher(self): self.assert_does_not_match( "sequence without 'a'", has_item(equal_to("a")), self._sequence("b", "c") ) self.assert_does_not_match("empty", has_item(equal_to("a")), [])
def testMatchesASequenceThatContainsAnElementMatchingTheGivenMatcher(self): self.assert_matches( "sequence contains 'a'", has_item(equal_to("a")), self._sequence("a", "b", "c") )