Created
January 14, 2022 20:44
-
-
Save guilhermecarvalhocarneiro/d7638be0d575153ef63a98ac2eddb1f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_orgao_list_queryset(self, init, client): | |
username = "user1" | |
password = "bar" | |
user = User.objects.create_user(username=username, password=password) | |
# Use this: | |
client.force_login(user) | |
# Or this: | |
client.login(username=username, password=password) | |
request = self.factory.get(reverse('orgao:orgao-list')) | |
request.user = user | |
response = OrgaoListView.as_view()(request) | |
assert response.status_code == 200 | |
assert response.context_data['object_list'].count() == 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment