def test_returns_only_users_dashboards(self): d = self.factory.create_dashboard(user=self.factory.user) d2 = self.factory.create_dashboard(user=self.factory.create_user()) dashboards = Dashboard.by_user(self.factory.user) # not using self.assertIn/NotIn because otherwise this fails :O self.assertTrue(d in list(dashboards)) self.assertFalse(d2 in list(dashboards))
def test_returns_drafts_by_the_user(self): d = self.factory.create_dashboard(is_draft=True) d2 = self.factory.create_dashboard(is_draft=True, user=self.factory.create_user()) dashboards = Dashboard.by_user(self.factory.user) # not using self.assertIn/NotIn because otherwise this fails :O self.assertTrue(d in dashboards) self.assertFalse(d2 in dashboards)