Beispiel #1
0
    def setUp(self):
        # Disable logging for tests
        logging.disable(logging.CRITICAL)

        self.maxDiff = 100000

        self.event = KompomaattiTestData.create_test_event('TestEvent')
        self.items = []
        self.variants = {}
        for i in range(6):
            item = StoreTestData.create_test_item("TestItem {}".format(i), self.event, sort_index=i)
            self.items.append(item)
            self.variants[i] = StoreTestData.create_test_variants(item, 5)

        # Item 4 is not available
        self.items[4].available = False
        self.items[4].save()

        # Item 3 max product count is 0 (should not be available)
        self.items[3].max = 0
        self.items[3].save()

        # Item 2 has a discount with 5 items by 50%
        self.items[2].discount_amount = 5
        self.items[2].discount_percentage = 50
        self.items[2].save()

        # Item 5 is free
        self.items[5].price = 0
        self.items[5].save()

        # Create a test transaction
        self.transaction = StoreTestData.create_test_transaction(self.items, self.variants)
Beispiel #2
0
    def setUp(self):
        # Disable logging for tests
        logging.disable(logging.CRITICAL)

        self.maxDiff = 100000

        self.event = KompomaattiTestData.create_test_event('TestEvent')
        self.items = []
        self.variants = {}
        for i in range(7):
            item = StoreTestData.create_test_item("TestItem {}".format(i), self.event, sort_index=i)
            self.items.append(item)
            self.variants[i] = StoreTestData.create_test_variants(item, 5)

        # Item 4 is not available
        self.items[4].available = False
        self.items[4].save()

        # Item 3 max product count is 0 (should not be available)
        self.items[3].max = 0
        self.items[3].save()

        # Item 2 has a discount with 5 items by 50%
        self.items[2].discount_amount = 5
        self.items[2].discount_percentage = 50
        self.items[2].save()

        # Item 5 is free
        self.items[5].price = 0
        self.items[5].save()

        # Item 6 is secret
        self.items[6].name = 'Secret item'
        self.items[6].is_secret = True
        self.items[6].secret_key = 'kissa'
        self.items[6].save()

        # Create a test transaction
        self.transaction = StoreTestData.create_test_transaction(self.items, self.variants)
Beispiel #3
0
    def create_full_started_transaction():
        event = KompomaattiTestData.create_test_event(fake.words(3))
        test_items = []
        for i in range(15 + random.randint(0, 10)):
            item = StoreTestData.create_test_item(fake.words(3), event)
            variants = StoreTestData.create_test_variants(
                item, random.randint(0, 5))
            for variant in variants:
                test_items.append({
                    "item_id": item.id,
                    "variant_id": variant.id,
                    "amount": random.randint(1, 10)
                })
            test_items.append({
                "item_id": item.id,
                "variant_id": None,
                "amount": random.randint(1, 10)
            })

        item = {
            "first_name": fake.first_name(),
            "last_name": fake.last_name(),
            "company": fake.company(),
            "email": fake.email(),
            "telephone": fake.phone_number(),
            "mobile": fake.phone_number(),
            "street": fake.street_address(),
            "postal_code": fake.postcode(),
            "city": fake.city(),
            "country": fake.country_code(),
            "information": fake.sentences(1),
            "items": test_items
        }
        ta = create_store_transaction(item)
        ta.token = uuid.uuid4().hex
        ta.payment_method_name = fake.words(1)
        ta.save()
        return ta
Beispiel #4
0
    def create_full_started_transaction():
        event = KompomaattiTestData.create_test_event(fake.words(3))
        test_items = []
        for i in range(15 + random.randint(0, 10)):
            item = StoreTestData.create_test_item(fake.words(3), event)
            variants = StoreTestData.create_test_variants(item, random.randint(0, 5))
            for variant in variants:
                test_items.append({
                    "item_id": item.id,
                    "variant_id": variant.id,
                    "amount": random.randint(1, 10)
                })
            test_items.append({
                "item_id": item.id,
                "variant_id": None,
                "amount": random.randint(1, 10)
            })

        item = {
            "first_name": fake.first_name(),
            "last_name": fake.last_name(),
            "company": fake.company(),
            "email": fake.email(),
            "telephone": fake.phone_number(),
            "mobile": fake.phone_number(),
            "street": fake.street_address(),
            "postal_code": fake.postcode(),
            "city": fake.city(),
            "country": fake.country_code(),
            "information": fake.sentences(1),
            "items": test_items
        }
        ta = create_store_transaction(item)
        ta.token = uuid.uuid4().hex
        ta.payment_method_name = fake.words(1)
        ta.save()
        return ta
Beispiel #5
0
    def setUp(self):
        self.event = KompomaattiTestData.create_test_event('TestEvent')
        self.items = []
        self.variants = {}
        for i in range(5):
            item = StoreTestData.create_test_item("TestItem {}".format(i), self.event, sort_index=i)
            self.items.append(item)
            self.variants[i] = StoreTestData.create_test_variants(item, 5)

        # Item 4 is not available
        self.items[4].available = False
        self.items[4].save()

        # Item 3 max product count is 0 (should not be available)
        self.items[3].max = 0
        self.items[3].save()

        # Item 2 has a discount with 5 items by 50%
        self.items[2].discount_amount = 5
        self.items[2].discount_percentage = 50
        self.items[2].save()

        # Create a test transaction
        self.transaction = StoreTestData.create_test_transaction(self.items, self.variants)