forked from EGCETSII/decide_django_2
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Recuperando archivo de tests de visualizer
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.test import TestCase | ||
from voting.tests import VotingTestCase | ||
# Create your tests here. | ||
class VisualizerTestCase(VotingTestCase): | ||
|
||
def setUp(self): | ||
super().setUp() | ||
|
||
def tearDown(self): | ||
super().tearDown() | ||
|
||
def voteTallied(self): | ||
voting = self.create_voting() | ||
self.login() | ||
for action in ['start','stop', 'tally']: | ||
data = {'action': action} | ||
response = self.client.put('/voting/{}/'.format(voting.pk), data, format='json') | ||
return voting.pk | ||
|
||
def test_recibir_votos(self): | ||
votingpk = self.voteTallied() | ||
|
||
data = {'update_id': 339892899, 'message': {'message_id': 285, 'from': {'id': 2004953283, 'is_bot': False, 'first_name': 'Lui', 'language_code': 'es'}, 'chat': {'id': 0, 'first_name': 'Lui', 'type': 'private'}, 'date': 1640018166, 'text': '/start', 'entities': [{'offset': 0, 'length': 6, 'type': 'bot_command'}]}} | ||
response = self.client.put('/webhooks', data, format='json') | ||
self.assertEqual(response.status_code, 301) | ||
data2 = {'update_id': 339892900, 'message': {'message_id': 287, 'from': {'id': 2004953283, 'is_bot': False, 'first_name': 'Lui', 'language_code': 'es'}, 'chat': {'id': 0, 'first_name': 'Lui', 'type': 'private'}, 'date': 1640018174, 'text': '/visualizer {}'.format(votingpk), 'entities': [{'offset': 0, 'length': 11, 'type': 'bot_command'}]}} | ||
response = self.client.post('/webhooks', data2, format='json') | ||
self.assertEqual(response.status_code, 301) |