def test_activity_has_two_prices(self):
        billing = CustomerBilling(CalendarTestEvent().customer)

        billing.add(CalendarTestEvent(price=2100))
        billing.add(CalendarTestEvent(price=2000))
        self.assertIn(2100, billing.activities['Coaching'].prices.keys())
        self.assertIn(2000, billing.activities['Coaching'].prices.keys())
 def test_activities_in_dict(self):
     billing = CustomerBilling('Konux')
     billing.add(
         CalendarTestEvent(action='Coaching',
                           price=1800,
                           date=datetime(2019, 10, 7)))
     self.assertEqual(billing.activities['Coaching'].prices[1800].days[0],
                      datetime(2019, 10, 7))
    def test_activity_with_travel_expenses(self):
        billing = CustomerBilling(CalendarTestEvent().customer)

        billing.add(
            CalendarTestEvent(price=2100,
                              action='Coaching',
                              travel_expense=200))
        self.assertEqual(len(billing.activities), 2)
        self.assertIn(200, billing.activities['Reisekosten'].prices.keys())
    def test_add_activity_to_billing(self):
        billing = CustomerBilling(CalendarTestEvent().customer)

        billing.add(CalendarTestEvent(date=datetime(2019, 10, 7)))
        billing.add(CalendarTestEvent(date=datetime(2019, 10, 21)))
        billing.add(CalendarTestEvent(date=datetime(2019, 10, 23)))

        self.assertEqual([
            datetime(2019, 10, 7),
            datetime(2019, 10, 21),
            datetime(2019, 10, 23)
        ], billing.activities['Coaching'].prices[1800].days)
 def test_iterate_billing(self):
     billing = CustomerBilling('Konux')
     billing.add(
         CalendarTestEvent(action='Coaching',
                           price=1800,
                           date=datetime(2019, 10, 7)))
     for activity_name, activity in billing.activities.items():
         self.assertEqual('Coaching', activity_name)
         for price_value, price in activity.items():
             self.assertEqual(1800, price_value)
             for day in price.days:
                 self.assertEqual(datetime(2019, 10, 7), day)
    def test_dates_to_string(self):
        billing = CustomerBilling('Konux')
        billing.add(
            CalendarTestEvent(action='Coaching',
                              price=1800,
                              date=datetime(2019, 10, 7)))
        self.assertEqual('7. Oktober',
                         billing.activities['Coaching'].prices[1800].dates_str)

        billing.add(
            CalendarTestEvent(action='Coaching',
                              price=1800,
                              date=datetime(2019, 10, 21)))
        self.assertEqual('7., 21. Oktober',
                         billing.activities['Coaching'].prices[1800].dates_str)