コード例 #1
0
ファイル: testClientSummary.py プロジェクト: craftdata/eff
    def setUp(self):

        # Disconnect signals so there's no problem to use UserProfileFactory
        signals.post_save.disconnect(
            dispatch_uid='eff._models.user_profile.create_profile_for_user',
            sender=User)

        # Create a external source
        self.ext_src = ExternalSourceFactory(name='DotprojectMachinalis')

        # Create 2 client user and 2 companies.
        self.company = ClientFactory(name='Fake Client 1',
                                     external_source=self.ext_src)
        user = UserFactory(username='******')
        self.client1 = ClientProfileFactory(user=user, company=self.company)
        user = UserFactory(username='******')
        self.company2 = ClientFactory(name='Fake Client 2',
                                      external_source=self.ext_src)
        self.client2 = ClientProfileFactory(user=user, company=self.company2)

        # Create some commercial documents for company1
        self.billing = BillingFactory(client=self.company,
                                      amount=Decimal('1000'),
                                      date=date(2012, 5, 3),
                                      concept="Billing1 " + self.company.name,
                                      expire_date=date(2012, 5, 30),
                                      payment_date=date(2012, 5, 25))
        self.credit_note = CreditNoteFactory(client=self.company,
                                             amount=Decimal('100'),
                                             date=date(2012, 5, 4),
                                             concept="CreditNote1 " +
                                             self.company.name)
        self.payment = PaymentFactory(client=self.company,
                                      amount=Decimal('1500'),
                                      date=date(2012, 5, 2),
                                      concept="Payment1 " + self.company.name,
                                      status="Notified")

        # Create some commercial documents for company2
        BillingFactory(client=self.company2,
                       amount=Decimal('1200'),
                       date=date(2012, 5, 1),
                       concept="Billing2 " + self.company.name,
                       expire_date=date(2012, 5, 30),
                       payment_date=date(2012, 5, 25))
        CreditNoteFactory(client=self.company2,
                          amount=Decimal('200'),
                          date=date(2012, 5, 2),
                          concept="CreditNote2 " + self.company.name)
        PaymentFactory(client=self.company2,
                       amount=Decimal('1600'),
                       date=date(2012, 5, 7),
                       concept="Payment2 " + self.company.name,
                       status="Tracking")
        self.test_client = TestClient()
コード例 #2
0
ファイル: testModels.py プロジェクト: craftdata/eff
 def setUp(self):
     # Create some data for tests
     # An external source
     ext_src = ExternalSourceFactory(name='DotprojectMachinalis')
     # A client
     client = ClientFactory(name='client', external_source=ext_src)
     # Some commercial documents
     self.billing = BillingFactory(client=client)
     self.cnote = CreditNoteFactory(client=client)
     self.payment = PaymentFactory(client=client)
コード例 #3
0
ファイル: test_models.py プロジェクト: chrismcginlay/eduduck
 def test_model_with_sane_values(self):
     a_user = UserFactory()
     turing = datetime(1912, 6, 23, 12, 00, tzinfo=utc)
     a_payment = PaymentFactory(
         paying_user=a_user,
         tax_rate=Decimal(0.2),
         datestamp=turing,
         transaction_fee=Decimal(0.2),
     )
     self.assertEqual(a_payment.paying_user, a_user)
     dummy_model_type = ContentType.objects.get_for_model(DummyModel)
     self.assertEqual(a_payment.content_type, dummy_model_type)
     self.assertEqual(a_payment.fee_value, Decimal(1.00))
     self.assertEqual(a_payment.currency, u'GBP')
     self.assertEqual(a_payment.tax_rate, Decimal(0.2))
     self.assertEqual(a_payment.datestamp, turing)
     self.assertEqual(a_payment.method, u'Stripe')
     self.assertEqual(a_payment.transaction_fee, Decimal(0.20))
     self.assertEqual(a_payment.test_mode, True)
コード例 #4
0
ファイル: test_models.py プロジェクト: chrismcginlay/eduduck
 def test_out_of_bounds_tax_rate_raises_exceptions(self):
     a_payment = PaymentFactory()
     with self.assertRaises(ValidationError):
         a_payment.tax_rate = -0.3
         a_payment.full_clean()
コード例 #5
0
ファイル: test_models.py プロジェクト: chrismcginlay/eduduck
 def test_get_absolute_url(self):
     a_payment = PaymentFactory()
     expected_url = '/priced_items/payment/{0}/'.format(a_payment.pk)
     gau = a_payment.get_absolute_url()
     self.assertEqual(expected_url, gau)
コード例 #6
0
ファイル: test_models.py プロジェクト: chrismcginlay/eduduck
 def test_bogus_currency_raises_exceptions(self):
     a_payment = PaymentFactory()
     with self.assertRaises(ValidationError):
         a_payment.currency = 'potatoes'
         a_payment.full_clean()
コード例 #7
0
 def setUp(self):
     self.payment = PaymentFactory.create(status='created')
     self.client = Client()
コード例 #8
0
 def setUp(self):
     self.payment = PaymentFactory.create(status='created')
コード例 #9
0
ファイル: test_models.py プロジェクト: chrismcginlay/eduduck
 def test_out_of_bounds_fee_value_raises_exceptions(self):
     a_payment = PaymentFactory()
     with self.assertRaises(ValidationError):
         a_payment.fee_value = -0.3
         a_payment.full_clean()
コード例 #10
0
ファイル: test_models.py プロジェクト: chrismcginlay/eduduck
 def test_get_absolute_url(self):
     a_payment = PaymentFactory()
     expected_url = '/priced_items/payment/{0}/'.format(a_payment.pk)
     gau = a_payment.get_absolute_url()
     self.assertEqual(expected_url, gau)
コード例 #11
0
ファイル: test_models.py プロジェクト: chrismcginlay/eduduck
 def test_bogus_currency_raises_exceptions(self):
     a_payment = PaymentFactory()
     with self.assertRaises(ValidationError):
         a_payment.currency = 'potatoes'
         a_payment.full_clean()