Пример #1
0
 def test_is_called_with_backend_and_address_and_poll_id(self):
     view = UReporterApiView()
     kwargs = {"backend": "console", "user_address": "999", "poll_id": "12"}
     view.parse_url_parameters(kwargs)
     self.assertEqual("console", view.backend_name)
     self.assertEqual("999", view.user_address)
     self.assertEqual("12", view.poll_id)
 def test_get_connection_returns_connection_for_user_address(self):
     view = UReporterApiView()
     backend_name = "back"
     identity = "999"
     view.backend_name = backend_name
     view.user_address = identity
     view.backend, created = Backend.objects.get_or_create(name=backend_name)
     connection, connection_created = Connection.objects.get_or_create(identity=identity, backend=view.backend)
     self.assertEqual(connection.id, view.get_connection().id)
Пример #3
0
 def test_that_contact_does_not_exist_if_there_is_no_connection(self):
     view = UReporterApiView()
     connection = None
     self.assertEqual(False, view.contact_exists(connection))
Пример #4
0
 def test_that_contact_exists_when_connection_has_contact(self):
     view = UReporterApiView()
     connection = Connection(contact=Contact())
     self.assertEqual(True, view.contact_exists(connection))