def test_fields(self): """Testing PerforceTool authentication form fields""" form = PerforceTool.create_auth_form() self.assertEqual(list(form.fields), ['username', 'password']) self.assertEqual(form['username'].help_text, '') self.assertEqual(form['username'].label, 'Username') self.assertEqual(form['password'].help_text, '') self.assertEqual(form['password'].label, 'Password')
def test_load(self): """Tetting PerforceTool authentication form load""" repository = self.create_repository(tool_name='Perforce', username='******', password='******') form = PerforceTool.create_auth_form(repository=repository) form.load() self.assertEqual(form['username'].value(), 'test-user') self.assertEqual(form['password'].value(), 'test-pass')
def test_save(self): """Tetting PerforceTool authentication form save""" repository = self.create_repository(tool_name='Perforce') form = PerforceTool.create_auth_form(repository=repository, data={ 'username': '******', 'password': '******', }) self.assertTrue(form.is_valid()) form.save() self.assertEqual(repository.username, 'test-user') self.assertEqual(repository.password, 'test-pass')