Esempio n. 1
0
    def testValidate(self):

        form = MoneyForm({"money": "10", "money_currency": "SEK"})

        self.assertTrue(form.is_valid())

        result = form.cleaned_data['money']
        self.assertTrue(isinstance(result, Money))

        self.assertEquals(result.amount, Decimal("10"))
        self.assertEquals(result.currency, moneyed.SEK)
Esempio n. 2
0
 def testValidate(self):
 
     form = MoneyForm({"money":"10", "money_currency":"SEK"})
     
     self.assertTrue(form.is_valid())
     
     result = form.cleaned_data['money']
     self.assertTrue(isinstance(result, Money))
     
     self.assertEquals(result.amount, Decimal("10"))
     self.assertEquals(result.currency, moneyed.SEK)
Esempio n. 3
0
    def testRender(self):

        form = MoneyForm()
        expected = """<tr><th><label for="id_money">Money:</label></th><td><input id="id_money" name="money" type="text" /><select id="id_money_currency" name="money_currency">
<option value="a">a</option>
</select></td></tr>"""

        self.assertEquals(str(form), expected)
Esempio n. 4
0
    def testNonExistantCurrency(self):

        form = MoneyForm({"money": "10", "money_currency": "_XX!123_"})

        self.assertRaises(moneyed.CurrencyDoesNotExist, form.is_valid)
Esempio n. 5
0
    def testNonExistantCurrency(self):

        form = MoneyForm({"money": "10", "money_currency": "_XX!123_"})

        self.assertFalse(form.is_valid())
Esempio n. 6
0
 def testNonExistantCurrency(self):
 
     form = MoneyForm({"money":"10", "money_currency":"_XX!123_"})
     
     self.assertFalse(form.is_valid())