예제 #1
0
 def test_url_constraint(self):
     """Ensures bookmarks have unique URLs within an Account"""
     account = AccountFactory()
     bookmark_1 = BookmarkFactory(
                             account=account, url='http://www.example.com')
     bookmark_1.save()
     with self.assertRaises(IntegrityError):
         bookmark_2 = BookmarkFactory(
                             account=account, url='http://www.example.com')
예제 #2
0
 def test_url_constraint(self):
     """Ensures bookmarks have unique URLs within an Account"""
     account = AccountFactory()
     bookmark_1 = BookmarkFactory(account=account,
                                  url='http://www.example.com')
     bookmark_1.save()
     with self.assertRaises(IntegrityError):
         bookmark_2 = BookmarkFactory(account=account,
                                      url='http://www.example.com')
예제 #3
0
 def test_url_unconstrained(self):
     """URLs do not have to be unique for different Accounts' Bookmarks"""
     account_1 = AccountFactory()
     bookmark_1 = BookmarkFactory(
                         account=account_1, url='http://www.example.com')
     bookmark_1.save()
     account_2 = AccountFactory()
     try:
         bookmark_2 = BookmarkFactory(
                         account=account_2, url='http://www.example.com')
     except IntegrityError:
         self.fail("It looks like there's a Unique constraint on Bookmark.url, which there shouldn't be.")
예제 #4
0
 def test_url_unconstrained(self):
     """URLs do not have to be unique for different Accounts' Bookmarks"""
     account_1 = AccountFactory()
     bookmark_1 = BookmarkFactory(account=account_1,
                                  url='http://www.example.com')
     bookmark_1.save()
     account_2 = AccountFactory()
     try:
         bookmark_2 = BookmarkFactory(account=account_2,
                                      url='http://www.example.com')
     except IntegrityError:
         self.fail(
             "It looks like there's a Unique constraint on Bookmark.url, which there shouldn't be."
         )
예제 #5
0
 def test_save(self):
     """Calls the parent save() method when saving, so it actually saves"""
     bookmark = BookmarkFactory(title='My title')
     bookmark.save()
     b = Bookmark.objects.get(title='My title')
     self.assertEqual(b.pk, bookmark.pk)
예제 #6
0
 def test_save(self):
     """Calls the parent save() method when saving, so it actually saves"""
     bookmark = BookmarkFactory(title='My title')
     bookmark.save()
     b = Bookmark.objects.get(title='My title')
     self.assertEqual(b.pk, bookmark.pk)