<commit_before>from django.test import TestCase
from django.test.client import Client

from mock import patch

from signup import models as signup_api


@patch('signup.models.sequence_model.get_current_sequence_number', lambda: 1)

class ViewTest(TestCase):

    SIGNUP_DATA = {
        'email': '<EMAIL>',
        'questions': {
            'timezone': 'Africa/Johannesburg',
            'groupRadios': 'true', 
            'styleRadios': 'try', 
            'expertiseRadios': 'think',
        }
    }

    BIO_DATA = {
        'email': '<EMAIL>',
        'name': '<NAME>',
        'bio': 'This is some info',
        'avatar': 'http://placehold.it/120x120'
    }

    def test_sequence_redirect(self):
        c = Client()
        resp = c.get('/gallery/')
        self.assertRedirects(resp, '/gallery/1/')
    
    
    def test_un_signedup_bio(self):
        c = Client()
        resp = c.post('/gallery/1/save_bio/', self.BIO_DATA)
        self.assertRedirects(resp, '/')


    def test_signedup_bio(self):
        signup_api.create_signup(**self.SIGNUP_DATA)
        c = Client()
        resp = c.post('/gallery/1/save_bio/', self.BIO_DATA)
        self.assertRedirects(resp, '/gallery/1/')<commit_msg>Mock out send_confirmation_email in view test<commit_after>from django.test import TestCase
from django.test.client import Client

from mock import patch

from signup import models as signup_api


@patch('signup.models.sequence_model.get_current_sequence_number', lambda: 1)
class ViewTest(TestCase):

    SIGNUP_DATA = {
        'email': '<EMAIL>',
        'questions': {
            'timezone': 'Africa/Johannesburg',
            'groupRadios': 'true', 
            'styleRadios': 'try', 
            'expertiseRadios': 'think',
        }
    }

    BIO_DATA = {
        'email': '<EMAIL>',
        'name': 'Test User',
        'bio': 'This is some info',
        'avatar': 'http://placehold.it/120x120'
    }

    def test_sequence_redirect(self):
        c = Client()
        resp = c.get('/gallery/')
        self.assertRedirects(resp, '/gallery/1/')
    
    
    def test_un_signedup_bio(self):
        c = Client()
        resp = c.post('/gallery/1/save_bio/', self.BIO_DATA)
        self.assertRedirects(resp, '/')

    @patch('gallery.views.send_confirmation_email')
    def test_signedup_bio(self, patcher):
        signup_api.create_signup(**self.SIGNUP_DATA)
        c = Client()
        resp = c.post('/gallery/1/save_bio/', self.BIO_DATA)
        self.assertRedirects(resp, '/gallery/1/')
{'fraction_non_alphanumeric': 0.14251592356687898, 'fraction_numerical': 0.00875796178343949, 'mean_word_length': 2.4377564979480164, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2069965', 'n_tokens_mistral': 854, 'n_tokens_neox': 814, 'n_words': 153}