Beispiel #1
0
 def test_clean_keywords(self):
     data = {
         "name": "n",
         "publisher": "p1",
         "publication_date": "1999-09-09",
         "type": "J",
         "peer_reviewed": "Y",
         "keywords": "k",
         "website": "w",
     }
     form = VenueForm(data)
     if form.is_valid():
         x = form.clean_keywords()
         self.assertTrue(x == "k")
         self.assertTrue(form.fields['keywords'].label is None
                         or form.fields['keywords'].label == 'Keywords*')
Beispiel #2
0
    def test_fields(self):
        form = VenueForm()
        self.assertEquals(form.fields["name"].label, "Name*")
        self.assertEquals(form.fields["publisher"].label, "Publisher*")
        self.assertEquals(form.fields["publication_date"].label,
                          "Publication Date (yyyy-mm-dd)*")
        self.assertEquals(form.fields["type"].label, "Type*")
        self.assertEquals(form.fields["peer_reviewed"].label, "Peer Reviewed*")
        self.assertEquals(form.fields["keywords"].label, "Keywords*")
        self.assertEquals(form.fields["website"].label, "Website")

        for visible in form.visible_fields():
            self.assertEquals(visible.field.widget.attrs["class"],
                              "form-control")
            self.assertEquals(visible.field.widget.attrs["style"],
                              "width:25em")
Beispiel #3
0
 def test_clean_publication_date(self):
     data = {
         "name": "n",
         "publisher": "p1",
         "publication_date": "1999-09-09",
         "type": "J",
         "peer_reviewed": "Y",
         "keywords": "k",
         "website": "w",
     }
     form = VenueForm(data)
     if form.is_valid():
         x = form.clean_publication_date()
         self.assertEquals(x, dt.date(1999, 9, 9))
         self.assertTrue(form.fields['publication_date'].label is None
                         or form.fields['publication_date'].label
                         == 'Publication Date (yyyy-mm-dd)*')