django-data/image/biosample/tests/test_register.py 1 location
|
@@ 59-73 (lines=15) @@
|
| 56 |
|
self.url = reverse('biosample:register') |
| 57 |
|
self.response = self.client.get(self.url) |
| 58 |
|
|
| 59 |
|
def check_messages(self, response, tag, message_text): |
| 60 |
|
"""Check that a response has warnings""" |
| 61 |
|
|
| 62 |
|
# each element is an instance |
| 63 |
|
# of django.contrib.messages.storage.base.Message |
| 64 |
|
all_messages = [msg for msg in get_messages(response.wsgi_request)] |
| 65 |
|
|
| 66 |
|
found = False |
| 67 |
|
|
| 68 |
|
# I can have moltiple message, and maybe I need to find a specific one |
| 69 |
|
for message in all_messages: |
| 70 |
|
if tag in message.tags and message_text in message.message: |
| 71 |
|
found = True |
| 72 |
|
|
| 73 |
|
self.assertTrue(found) |
| 74 |
|
|
| 75 |
|
|
| 76 |
|
class RegisterUserViewTest(Basetest): |
django-data/image/biosample/tests/test_token.py 1 location
|
@@ 47-61 (lines=15) @@
|
| 44 |
|
self.url = reverse('biosample:token') |
| 45 |
|
self.response = self.client.get(self.url) |
| 46 |
|
|
| 47 |
|
def check_messages(self, response, tag, message_text): |
| 48 |
|
"""Check that a response has warnings""" |
| 49 |
|
|
| 50 |
|
# each element is an instance |
| 51 |
|
# of django.contrib.messages.storage.base.Message |
| 52 |
|
all_messages = [msg for msg in get_messages(response.wsgi_request)] |
| 53 |
|
|
| 54 |
|
found = False |
| 55 |
|
|
| 56 |
|
# I can have moltiple message, and maybe I need to find a specific one |
| 57 |
|
for message in all_messages: |
| 58 |
|
if tag in message.tags and message_text in message.message: |
| 59 |
|
found = True |
| 60 |
|
|
| 61 |
|
self.assertTrue(found) |
| 62 |
|
|
| 63 |
|
def test_redirection(self): |
| 64 |
|
'''Non Authenticated user are directed to login page''' |
django-data/image/common/tests/mixins.py 1 location
|
@@ 56-70 (lines=15) @@
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
class MessageMixinTestCase(object): |
| 56 |
|
def check_messages(self, response, tag, message_text): |
| 57 |
|
"""Check that a response has a message of a certain type""" |
| 58 |
|
|
| 59 |
|
# each element is an instance |
| 60 |
|
# of django.contrib.messages.storage.base.Message |
| 61 |
|
all_messages = [msg for msg in get_messages(response.wsgi_request)] |
| 62 |
|
|
| 63 |
|
found = False |
| 64 |
|
|
| 65 |
|
# I can have moltiple message, and maybe I need to find a specific one |
| 66 |
|
for message in all_messages: |
| 67 |
|
if tag in message.tags and message_text in message.message: |
| 68 |
|
found = True |
| 69 |
|
|
| 70 |
|
self.assertTrue(found) |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
class GeneralMixinTestCase(LoginMixinTestCase, StatusMixinTestCase, |
django-data/image/biosample/tests/test_token_generate.py 1 location
|
@@ 50-64 (lines=15) @@
|
| 47 |
|
self.url = reverse('biosample:token-generation') |
| 48 |
|
self.response = self.client.get(self.url) |
| 49 |
|
|
| 50 |
|
def check_messages(self, response, tag, message_text): |
| 51 |
|
"""Check that a response has warnings""" |
| 52 |
|
|
| 53 |
|
# each element is an instance |
| 54 |
|
# of django.contrib.messages.storage.base.Message |
| 55 |
|
all_messages = [msg for msg in get_messages(response.wsgi_request)] |
| 56 |
|
|
| 57 |
|
found = False |
| 58 |
|
|
| 59 |
|
# I can have moltiple message, and maybe I need to find a specific one |
| 60 |
|
for message in all_messages: |
| 61 |
|
if tag in message.tags and message_text in message.message: |
| 62 |
|
found = True |
| 63 |
|
|
| 64 |
|
self.assertTrue(found) |
| 65 |
|
|
| 66 |
|
|
| 67 |
|
class CreateAuthViewTest(BaseTest): |
django-data/image/biosample/tests/test_create.py 1 location
|
@@ 43-57 (lines=15) @@
|
| 40 |
|
self.url = reverse('biosample:create') |
| 41 |
|
self.response = self.client.get(self.url) |
| 42 |
|
|
| 43 |
|
def check_messages(self, response, tag, message_text): |
| 44 |
|
"""Check that a response has warnings""" |
| 45 |
|
|
| 46 |
|
# each element is an instance |
| 47 |
|
# of django.contrib.messages.storage.base.Message |
| 48 |
|
all_messages = [msg for msg in get_messages(response.wsgi_request)] |
| 49 |
|
|
| 50 |
|
found = False |
| 51 |
|
|
| 52 |
|
# I can have moltiple message, and maybe I need to find a specific one |
| 53 |
|
for message in all_messages: |
| 54 |
|
if tag in message.tags and message_text in message.message: |
| 55 |
|
found = True |
| 56 |
|
|
| 57 |
|
self.assertTrue(found) |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
class CreateUserViewTest(Basetest): |