From 3944f016233b3d9f00d045220db1bf89d8deee7a Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Feb 15 2017 10:30:34 +0000 Subject: Unit test: AddGroupForm of pagure.forms Signed-off-by: Vivek Anand --- diff --git a/tests/test_pagure_flask_form.py b/tests/test_pagure_flask_form.py index 5ec6e04..06c4928 100644 --- a/tests/test_pagure_flask_form.py +++ b/tests/test_pagure_flask_form.py @@ -129,6 +129,20 @@ class PagureFlaskFormTests(tests.Modeltests): # Everything given self.assertTrue(form.validate_on_submit()) + def test_add_group_form(self): + """ Test the AddGroupForm form of pagure.forms """ + with pagure.APP.test_request_context(method='POST'): + form = pagure.forms.AddGroupForm() + form.csrf_token.data = form.csrf_token.current_token + # No group given + self.assertFalse(form.validate_on_submit()) + # No access given + form.group.data = 'gname' + self.assertFalse(form.validate_on_submit()) + form.access.data = 'admin' + self.assertTrue(form.validate_on_submit()) + + if __name__ == '__main__': SUITE = unittest.TestLoader().loadTestsFromTestCase(