Exemple #1
0
def issuer_register(request):
    if request.method == 'POST':
        form = IssuerForm(request.POST)
        form.is_valid()
        obj = Issuer(**form.cleaned_data)
        obj.save()
        return HttpResponseRedirect('/emitente/%d/' % obj.pk)
    else:
        return direct_to_template(
            request
            , 'registers/issuer_form.xhtml'
            , {'form': IssuerForm()}
        )
Exemple #2
0
class IssuerTest(TestCase):
    def setUp(self):
        self.obj = Issuer(
            name = 'Fatec Ourinhos'
        )
    
    def test_create_issuer(self):
        'Issuer must have name.'
        self.obj.save()
        self.assertEqual(1, self.obj.id)
        
    def test_unicode(self):
        'Must be return a unicode.'
        self.assertEqual(u'Fatec Ourinhos', unicode(self.obj))
Exemple #3
0
 def setUp(self):
     self.obj = Issuer(
         name = 'Fatec Ourinhos'
     )