From 5ba4e2fdbe152ec447828df92ecbf981b18d6c7c Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Mar 15 2017 13:46:16 +0000 Subject: watch feature: Unit test for reset option Signed-off-by: Vivek Anand --- diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index 95f3784..aa81748 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -4134,6 +4134,13 @@ index 0000000..fb7093d pygit2.init_repository(gitrepo, bare=True) output = self.app.post( + '/fork/foo/test/watch/settings/-1', data=data, + follow_redirects=True) + self.assertIn( + '\n Watch status is already reset', + output.data) + + output = self.app.post( '/fork/foo/test/watch/settings/0', data=data, follow_redirects=True) self.assertIn( @@ -4147,6 +4154,14 @@ index 0000000..fb7093d '\n You are now' ' watching this repo.', output.data) + output = self.app.post( + '/fork/foo/test/watch/settings/-1', data=data, + follow_redirects=True) + self.assertIn( + '\n Watch status reset', + output.data) + + def test_delete_report(self): """ Test the delete_report endpoint. """ diff --git a/tests/test_pagure_lib.py b/tests/test_pagure_lib.py index 5d22525..0697f5b 100644 --- a/tests/test_pagure_lib.py +++ b/tests/test_pagure_lib.py @@ -3034,6 +3034,16 @@ class PagureLibtests(tests.Modeltests): watch=True, ) + # All good and when user seleted reset watch option. + msg = pagure.lib.update_watch_status( + session=self.session, + project=project, + user='pingou', + watch='-1', + ) + self.session.commit() + self.assertEqual(msg, 'Watch status is already reset') + # All good and when user seleted watch option. msg = pagure.lib.update_watch_status( session=self.session, @@ -3054,6 +3064,16 @@ class PagureLibtests(tests.Modeltests): self.session.commit() self.assertEqual(msg, 'You are no longer watching this repo.') + # All good and when user seleted reset watch option. + msg = pagure.lib.update_watch_status( + session=self.session, + project=project, + user='pingou', + watch='-1', + ) + self.session.commit() + self.assertEqual(msg, 'Watch status reset') + def test_is_watching(self): """ Test the is_watching method of pagure.lib. """ tests.create_projects(self.session)