예제 #1
0
 def test_invalid_code_activation(self):
     # resubmit
     response = self.activate(code=User.generate_code('random'),
                              password='******',
                              re_password='******')
     self.assertEqual(response.status_code, 200)
     self.assertIn(b'Could not find the code', response.data)
예제 #2
0
    def test_invalid_re_activation(self):
        username = '******'
        response = self.register(username)
        self.assertEqual(response.status_code, 200)
        self.assertIn(b'Registered successfully', response.data)

        # use the saved code to activate
        password = '******'
        response = self.activate(code=User.generate_code(username),
                                 password=password,
                                 re_password=password)
        self.assertEqual(response.status_code, 200)
        self.assertIn(b'created successfully', response.data)

        # resubmit
        response = self.activate(code=User.generate_code(username),
                                 password=password,
                                 re_password=password)
        self.assertEqual(response.status_code, 200)
        self.assertIn(b'Could not find the code', response.data)