Beispiel #1
0
    def test_FindUpdatedPackageReturnsSamePackage(self):
        packageRepository = PackageRepository()
        packageRepository.Insert(
            PackageObjectMother.CreatePackageNoPickupsNoReturn())
        packageRepository.Insert(
            PackageObjectMother.CreatePackageManyPickupNoReturn())
        packageRepository.Insert(
            PackageObjectMother.CreatePackageManyPickupPackedNoReturn())
        packageRepository.Insert(
            PackageObjectMother.CreateDeliveredPackageManyPickupPackedNoReturn(
            ))
        packageRepository.Insert(
            PackageObjectMother.CreatePackageManyPickupPackedUnconfirmedReturn(
            ))
        packageRepository.Insert(
            PackageObjectMother.CreatePackageManyPickupPackedConfirmedReturn())
        packages = packageRepository.FindAll()
        package = packages[0]

        package.DeliveryDate = datetime(2018, 12, 30)
        package.GetStatus().NextDeliveryStep()
        return_ = package.GetReturn()
        if not return_:
            package.MakeReturn("Sample text")
        else:
            return_.Description = "Sample text"
        packageRepository.Update(package)
        packageAfterInsert = packageRepository.Find(package.PackageCode)

        assert packageAfterInsert.PackageCode == package.PackageCode
        assert packageAfterInsert.DeliveryDate == datetime(2018, 12, 30).date()
        assert packageAfterInsert.GetReturn().Description == "Sample text"
Beispiel #2
0
 def test_CreateAllObjectsFromObjectMother(self):
     p = PackageObjectMother.CreatePackageNoPickupsNoReturn()
     p = PackageObjectMother.CreatePackageManyPickupNoReturn()
     p = PackageObjectMother.CreatePackageManyPickupPackedNoReturn()
     p = PackageObjectMother.CreateDeliveredPackageManyPickupPackedNoReturn(
     )
     p = PackageObjectMother.CreatePackageManyPickupPackedUnconfirmedReturn(
     )
     p = PackageObjectMother.CreatePackageManyPickupPackedConfirmedReturn()
     p = PackageObjectMother.CreateUnpackedPickups()
     p = PackageObjectMother.CreatePackedPickups()
     p = PackageObjectMother.CreateUnconfirmedReturn()
     p = PackageObjectMother.CreateConfirmedReturn()