Beispiel #1
0
    def test_should_have_user_as_addressable(self):
        """
        Prueba que una direccion pueda ser asociada
        a un usuario
        """

        user = User(email="*****@*****.**", name="nada", last_name="mas")
        user.save()

        address = Address()
        address.street1 = "Cra 7 # 6-19"
        address.addressable_object = user
        address.save()

        address_from_db = Address.objects.get(id=address.id)
        self.assertEqual(address_from_db.addressable_type.name, 'user')
Beispiel #2
0
    def test_should_have_store_as_addressable(self):
        """
        Prueba que una direccion pueda ser asociada
        a una tienda
        """

        store = Store(name="My store")
        store.save()

        address = Address()
        address.street1 = "Cra 7 # 6-19"
        address.addressable_object = store
        address.save()

        address_from_db = Address.objects.get(id=address.id)
        self.assertEqual(address_from_db.addressable_type.name, 'store')
Beispiel #3
0
    def test_should_have_creditcard_as_addressable(self):
        """
        Prueba que una direccion pueda ser asociada
        a una tarjeta de credito
        """

        credit_card = CreditCard(number="1111111111")
        credit_card.save()

        address = Address()
        address.street1 = "Cra 7 # 6-19"
        address.addressable_object = credit_card
        address.save()

        address_from_db = Address.objects.get(id=address.id)
        self.assertEqual(address_from_db.addressable_type.name, 'credit card')
    def test_should_have_creditcard_as_addressable(self):
        """
        Prueba que una direccion pueda ser asociada
        a una tarjeta de credito
        """

        credit_card = CreditCard(number="1111111111")
        credit_card.save()

        address = Address()
        address.street1 = "Cra 7 # 6-19"
        address.addressable_object = credit_card 
        address.save()

        address_from_db = Address.objects.get(id=address.id)
        self.assertEqual(address_from_db.addressable_type.name, 'credit card')
    def test_should_have_user_as_addressable(self):
        """
        Prueba que una direccion pueda ser asociada
        a un usuario
        """

        user = User(email="*****@*****.**", name="nada", last_name="mas")
        user.save()

        address = Address()
        address.street1 = "Cra 7 # 6-19"
        address.addressable_object = user
        address.save()

        address_from_db = Address.objects.get(id=address.id)
        self.assertEqual(address_from_db.addressable_type.name, 'user')
    def test_should_have_store_location_as_addressable(self):
        """
        Prueba que una direccion pueda ser asociada
        a una ubicacion de tienda
        """

        store = StoreLocation(city="Chia")
        store.save()

        address = Address()
        address.street1 = "Cra 7 # 6-19"
        address.addressable_object = store 
        address.save()

        address_from_db = Address.objects.get(id=address.id)
        self.assertEqual(address_from_db.addressable_type.name, 'store location')
    def test_should_have_store_as_addressable(self):
        """
        Prueba que una direccion pueda ser asociada
        a una tienda
        """

        store = Store(name="My store")
        store.save()

        address = Address()
        address.street1 = "Cra 7 # 6-19"
        address.addressable_object = store 
        address.save()

        address_from_db = Address.objects.get(id=address.id)
        self.assertEqual(address_from_db.addressable_type.name, 'store')
Beispiel #8
0
    def test_should_have_store_location_as_addressable(self):
        """
        Prueba que una direccion pueda ser asociada
        a una ubicacion de tienda
        """

        store = StoreLocation(city="Chia")
        store.save()

        address = Address()
        address.street1 = "Cra 7 # 6-19"
        address.addressable_object = store
        address.save()

        address_from_db = Address.objects.get(id=address.id)
        self.assertEqual(address_from_db.addressable_type.name,
                         'store location')