Skip to content

Instantly share code, notes, and snippets.

View andrea-mucci's full-sized avatar

Andrea Mucci andrea-mucci

  • Clariteia
  • madrid
View GitHub Profile
class TestPaymentCommandService(unittest.IsolatedAsyncioTestCase):
def setUp(self) -> None:
self.injector = build_dependency_injector()
async def asyncSetUp(self) -> None:
await self.injector.wire(modules=[sys.modules[__name__]])
async def asyncTearDown(self) -> None:
await self.injector.unwire()
@andrea-mucci
andrea-mucci / faker.sh
Created March 22, 2022 16:22
install faker
poetry add faker --dev
@andrea-mucci
andrea-mucci / command_service.py
Created March 22, 2022 16:20
Payment Command
class PaymentCommandService(CommandService):
"""PaymentCommandService class."""
def validate_card(self, card_number: str) -> bool:
def digits_of(n):
return [int(d) for d in str(n)]
digits = digits_of(card_number)
odd_digits = digits[-1::-2]
even_digits = digits[-2::-2]
@andrea-mucci
andrea-mucci / test_service.py
Created March 15, 2022 15:05
test notifier command service
import sys
import unittest
from src import (
Notifier,
NotifierCommandService,
)
from minos.networks import (
InMemoryRequest,
@andrea-mucci
andrea-mucci / command.py
Created March 15, 2022 14:59
Notifier Command Service
import smtplib
import ssl
from email.mime.multipart import (
MIMEMultipart,
)
from email.mime.text import (
MIMEText,
)
from minos.cqrs import (
@andrea-mucci
andrea-mucci / test_service.py
Created March 14, 2022 18:28
test currency command
import sys
import unittest
from src import (
Currency,
CurrencyCommandService,
)
from minos.networks import (
InMemoryRequest,
@andrea-mucci
andrea-mucci / command.py
Created March 14, 2022 18:26
Currency CommandService
from minos.cqrs import (
CommandService,
)
from minos.networks import (
Request,
Response,
ResponseException,
enroute,
)
import os.path as op
@andrea-mucci
andrea-mucci / currency.sh
Created March 14, 2022 18:25
add CurrencyConverter
poetry add CurrencyConverter
@andrea-mucci
andrea-mucci / test_service.py
Created March 14, 2022 18:04
command test file
import sys
import unittest
from src import (
ShippingCommandService,
)
from minos.networks import (
InMemoryRequest,
Response,
@andrea-mucci
andrea-mucci / command.py
Created March 14, 2022 17:57
Shipping Command Service
import haversine as haversine
from geopy.geocoders import (
Nominatim,
)
from minos.cqrs import (
CommandService,
)
from minos.networks import (
Request,