def test_validate_category_name_passes(self): self.given_data('not-yet-existing-category') self.when_calling(types.category_name) self.then_invocation_passed_with(AnyResult())
def test_validate_list_of_user_ids_passes(self): self.given_data([1, 2, 34, 678]) self.when_calling(types.list_of_userids) self.then_invocation_passed_with(AnyResult())
def test_validate_message_passes(self): self.given_data({'content': 'woo message', 'type': 'TEXT'}) self.when_calling(types.message) self.then_invocation_passed_with(AnyResult())
def test_validate_chat_name_passes(self): self.given_data('my super cool group chat') self.when_calling(types.chat_name) self.then_invocation_passed_with(AnyResult())
def test_validate_user_email_passes(self): self.given_data('*****@*****.**') self.when_calling(types.user_email) self.then_invocation_passed_with(AnyResult())
def test_has_key_accepts_item_with_key(self): self.given_data({'thekey': 123}) self.when_calling(HasKey('thekey')) self.then_invocation_passed_with(AnyResult())
def test_validate_message_content_passes(self): self.given_data('This is the message content. ☺') self.when_calling(types.message_content) self.then_invocation_passed_with(AnyResult())
def test_validate_user_password_passes(self): self.given_data('my-secret-P4ssw0rd') self.when_calling(types.user_password) self.then_invocation_passed_with(AnyResult())
def test_validate_user_display_name_passes(self): self.given_data('Adam') self.when_calling(types.user_display_name) self.then_invocation_passed_with(AnyResult())
def test_and_then_accepts_sequence_that_does_validate(self): self.given_data({'thekey': 1}) self.when_calling(AndThen(HasKey('thekey'), OfType(int))) self.then_invocation_passed_with(AnyResult())
def test_validate_category_parent_passes(self): self.given_data(MockCategory.create().id) self.when_calling(types.category_parent) self.then_invocation_passed_with(AnyResult())
def test_each_accepts_item_with_members_that_validate(self): self.given_data([1, 2, 3]) self.when_calling(Each(OfType(int))) self.then_invocation_passed_with(AnyResult())
def test_of_type_accepts_item_of_same_type(self): self.given_data({'my': 'dict'}) self.when_calling(OfType(dict)) self.then_invocation_passed_with(AnyResult())
def test_is_in_accepts_contained_item(self): self.given_data('that') self.when_calling(IsIn('this', 'and', 'that')) self.then_invocation_passed_with(AnyResult())
def test_from_http_request_creates_json_request(self): self.given_json_request(body={'foo': 1}) self.when_calling(JsonRequest.from_http_request) self.then_invocation_passed_with(AnyResult())
def test_validate_message_type_passes_for_image(self): self.given_data('IMAGE') self.when_calling(types.message_type) self.then_invocation_passed_with(AnyResult())
def test_chat_with_empty_messages_serializable(self): self.given_data(ConversationModel.objects.create()) self.when_calling(serializers.conversation) self.then_invocation_passed_with(AnyResult())
def test_shorter_than_accepts_short_item(self): self.given_data('123') self.when_calling(ShorterThan(5)) self.then_invocation_passed_with(AnyResult())