Fix/update tests
This commit is contained in:
parent
6e94890e0e
commit
c12ba968b8
4 changed files with 5 additions and 4 deletions
|
|
@ -202,7 +202,7 @@ class NestedRuleListViewTestCase(TestCase):
|
||||||
|
|
||||||
for post in data["results"]:
|
for post in data["results"]:
|
||||||
with self.subTest(post=post):
|
with self.subTest(post=post):
|
||||||
self.assertEqual(post["rule"], rule.pk)
|
self.assertEqual(post["rule"]["id"], rule.pk)
|
||||||
|
|
||||||
def test_unread_posts(self):
|
def test_unread_posts(self):
|
||||||
rule = FeedFactory.create(user=self.user)
|
rule = FeedFactory.create(user=self.user)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class PostSerializer(serializers.ModelSerializer):
|
||||||
)
|
)
|
||||||
remoteIdentifier = serializers.CharField(source="remote_identifier", required=False)
|
remoteIdentifier = serializers.CharField(source="remote_identifier", required=False)
|
||||||
|
|
||||||
rule = RuleSerializer()
|
rule = RuleSerializer(read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Post
|
model = Post
|
||||||
|
|
|
||||||
|
|
@ -510,8 +510,8 @@ class NestedCategoryPostView(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEqual(len(data["results"]), 2)
|
self.assertEqual(len(data["results"]), 2)
|
||||||
|
|
||||||
self.assertEqual(posts[0]["rule"], guardian_rule.pk)
|
self.assertEqual(posts[0]["rule"]["id"], guardian_rule.pk)
|
||||||
self.assertEqual(posts[1]["rule"], guardian_rule.pk)
|
self.assertEqual(posts[1]["rule"]["id"], guardian_rule.pk)
|
||||||
|
|
||||||
def test_unread_posts(self):
|
def test_unread_posts(self):
|
||||||
category = CategoryFactory.create(user=self.user)
|
category = CategoryFactory.create(user=self.user)
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ class PostDetailViewTestCase(TestCase):
|
||||||
data=json.dumps({"title": "This title is very accurate"}),
|
data=json.dumps({"title": "This title is very accurate"}),
|
||||||
content_type="application/json",
|
content_type="application/json",
|
||||||
)
|
)
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue