Beispiel #1
0
def cipher_input(request):
    if request.method == "POST":
        form = InputForm(request.POST)
        if form.is_valid():
            string = form.cleaned_data['string']
            offset = form.cleaned_data['offset']
            output = cipher(string, offset)
            return index(request, output)
Beispiel #2
0
 def test_shifts_lower_case_letters(self):
     test = cipher('abc')
     self.assertEquals(test, 'def')
Beispiel #3
0
 def test_works_with_big_positive_offset(self):
     test = cipher('Abc Xyz', 50)
     self.assertEquals(test, 'Yza Vwx')
Beispiel #4
0
 def test_works_with_small_positive_offset(self):
     test = cipher('Abc Xyz', 1)
     self.assertEquals(test, 'Bcd Yza')
Beispiel #5
0
 def test_doesnt_change_numbers(self):
     test = cipher('Abc123 Xyz456')
     self.assertEquals(test, 'Def123 Abc456')
Beispiel #6
0
 def test_doesnt_change_spaces(self):
     test = cipher('Abc Xyz')
     self.assertEquals(test, 'Def Abc')
Beispiel #7
0
 def test_shifts_over_end(self):
     test = cipher('Xyz')
     self.assertEquals(test, 'Abc')
Beispiel #8
0
 def test_shifts_mixed_letters(self):
     test = cipher('AbC')
     self.assertEquals(test, 'DeF')
Beispiel #9
0
 def test_shifts_upper_case_letters(self):
     test = cipher('ABC')
     self.assertEquals(test, 'DEF')