Skip to content

Commit b42035a

Browse files
hallvictoriavrdmr
andauthored
ServiceBusMessage testing fix (#192)
* servicebusmessage for unit tests * correct return types * constructor tests * full constructor test * added test for abstract methods * fix lint errors * fix assert error * edited tests * edited codecov tool --------- Co-authored-by: Varad Meru <[email protected]>
1 parent 717bf06 commit b42035a

File tree

5 files changed

+309
-58
lines changed

5 files changed

+309
-58
lines changed

.coveragerc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ omit =
3838
*/venv/*
3939
*/.venv/*
4040
*/.env*/*
41-
*/.vscode/*
41+
*/.vscode/*
42+
azure/functions/_abc.py

azure/functions/_abc.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,3 +439,117 @@ class OrchestrationContext(abc.ABC):
439439
@abc.abstractmethod
440440
def body(self) -> str:
441441
pass
442+
443+
444+
class ServiceBusMessage(abc.ABC):
445+
446+
@abc.abstractmethod
447+
def get_body(self) -> typing.Union[str, bytes]:
448+
pass
449+
450+
@property
451+
@abc.abstractmethod
452+
def content_type(self) -> typing.Optional[str]:
453+
pass
454+
455+
@property
456+
@abc.abstractmethod
457+
def correlation_id(self) -> typing.Optional[str]:
458+
pass
459+
460+
@property
461+
@abc.abstractmethod
462+
def dead_letter_source(self) -> typing.Optional[str]:
463+
pass
464+
465+
@property
466+
@abc.abstractmethod
467+
def delivery_count(self) -> typing.Optional[int]:
468+
pass
469+
470+
@property
471+
@abc.abstractmethod
472+
def enqueued_time_utc(self) -> typing.Optional[datetime.datetime]:
473+
pass
474+
475+
@property
476+
@abc.abstractmethod
477+
def expires_at_utc(self) -> typing.Optional[datetime.datetime]:
478+
pass
479+
480+
@property
481+
@abc.abstractmethod
482+
def expiration_time(self) -> typing.Optional[datetime.datetime]:
483+
"""(Deprecated, use expires_at_utc instead)"""
484+
pass
485+
486+
@property
487+
@abc.abstractmethod
488+
def label(self) -> typing.Optional[str]:
489+
pass
490+
491+
@property
492+
@abc.abstractmethod
493+
def lock_token(self) -> typing.Optional[str]:
494+
pass
495+
496+
@property
497+
@abc.abstractmethod
498+
def message_id(self) -> str:
499+
pass
500+
501+
@property
502+
@abc.abstractmethod
503+
def partition_key(self) -> typing.Optional[str]:
504+
pass
505+
506+
@property
507+
@abc.abstractmethod
508+
def reply_to(self) -> typing.Optional[str]:
509+
pass
510+
511+
@property
512+
@abc.abstractmethod
513+
def reply_to_session_id(self) -> typing.Optional[str]:
514+
pass
515+
516+
@property
517+
@abc.abstractmethod
518+
def scheduled_enqueue_time(self) -> typing.Optional[datetime.datetime]:
519+
"""(Deprecated, use scheduled_enqueue_time_utc instead)"""
520+
pass
521+
522+
@property
523+
@abc.abstractmethod
524+
def scheduled_enqueue_time_utc(self) -> typing.Optional[datetime.datetime]:
525+
pass
526+
527+
@property
528+
@abc.abstractmethod
529+
def sequence_number(self) -> typing.Optional[int]:
530+
pass
531+
532+
@property
533+
@abc.abstractmethod
534+
def session_id(self) -> typing.Optional[str]:
535+
pass
536+
537+
@property
538+
@abc.abstractmethod
539+
def time_to_live(self) -> typing.Optional[datetime.timedelta]:
540+
pass
541+
542+
@property
543+
@abc.abstractmethod
544+
def to(self) -> typing.Optional[str]:
545+
pass
546+
547+
@property
548+
@abc.abstractmethod
549+
def user_properties(self) -> typing.Dict[str, typing.Any]:
550+
pass
551+
552+
@property
553+
@abc.abstractmethod
554+
def metadata(self) -> typing.Optional[typing.Dict[str, typing.Any]]:
555+
pass

0 commit comments

Comments
 (0)