def test_create(self): label = "friends_invite" NoticeType.create(label, "Invitation Received", "you received an invitation", default=2) n = NoticeType.objects.get(label=label) self.assertEqual(str(n), label) # update NoticeType.create(label, "Invitation for you", "you got an invitation", default=1) n = NoticeType.objects.get(pk=n.pk) self.assertEqual(n.display, "Invitation for you") self.assertEqual(n.description, "you got an invitation") self.assertEqual(n.default, 1)
def setUp(self): self.user = get_user_model().objects.create_user("test_user", "*****@*****.**", "123456") self.user2 = get_user_model().objects.create_user("test_user2", "*****@*****.**", "123456") NoticeType.create("label", "display", "description") self.notice_type = NoticeType.objects.get(label="label")
def setUp(self): self.user = get_user_model().objects.create_user("test_user", "*****@*****.**", "123456") self.user2 = get_user_model().objects.create_user("test_user2", "*****@*****.**", "123456") NoticeType.create("label", "display", "description") NoticeType.create("label2", "display2", "description2") NoticeType.create("different", "display Different", "description3")