Пример #1
0
class BibliographyTestCase(unittest.TestCase):

    def setUp(self):
        """
        Sets up the project
        """
        self.bibwithoutspace = Bibliography(name="Friction")
        self.bibwithspace = Bibliography(
            name="The Effects of the coeficent of friction on stopping distance.",
            create_date=timezone.now())

    def test_bibliography_without_space_represented_correctly(self):
        """
        Asserts that bibliographies with spaces are represtented correctly
        """
        self.assertEqual(self.bibwithoutspace.__unicode__(), u'Friction')

    def test_bibliography_with_space_represented_correctly(self):
        """
        Asserts that bibliographies with spaces are represtented correctly
        """
        self.assertEqual(self.bibwithspace.__unicode__(),
                         u'The Effects of the coeficent of friction on stopping distance.')

    def test_future_bibliography_wasnt_created_recently(self):
        """
        Asserts that a bibliography created in the future isn't counted as new
        """
        future_bib = Bibliography(name='test',
                                  create_date=timezone.now()
                                  + datetime.timedelta(days=30))
        self.assertEqual(future_bib.was_created_recently(), False)
Пример #2
0
 def test_future_bibliography_wasnt_created_recently(self):
     """
     Asserts that a bibliography created in the future isn't counted as new
     """
     future_bib = Bibliography(name='test',
                               create_date=timezone.now()
                               + datetime.timedelta(days=30))
     self.assertEqual(future_bib.was_created_recently(), False)
Пример #3
0
 def setUp(self):
     """
     Sets up the project
     """
     self.bibwithoutspace = Bibliography(name="Friction")
     self.bibwithspace = Bibliography(
         name="The Effects of the coeficent of friction on stopping distance.",
         create_date=timezone.now())