def test_should_commit_transaction(self): self.context.task['payload']['commit'] = True self.assertTrue(should_commit_transaction(self.context)) self.context.task['payload']['commit'] = False self.assertFalse(should_commit_transaction(self.context)) del self.context.task['payload']['commit'] self.assertFalse(should_commit_transaction(self.context))
def test_should_commit_transaction(): task_payload = { 'commit': True } assert should_commit_transaction(task_payload) is True task_payload = { 'commit': False } assert should_commit_transaction(task_payload) is False task_payload = {} assert should_commit_transaction(task_payload) is False
def _log_warning_forewords(context): if googleplay.is_allowed_to_push_to_google_play(context): if googleplay.should_commit_transaction(context): log.warn('You will publish APKs to Google Play. This action is irreversible,\ if no error is detected either by this script or by Google Play.') else: log.warn('APKs will be submitted to Google Play, but no change will not be committed.') else: log.warn('You do not have the rights to reach Google Play. *All* requests will be mocked.')
def _log_warning_forewords(contact_google_play, task_payload): if contact_google_play: if googleplay.should_commit_transaction(task_payload): log.warning( 'You will publish APKs to Google Play. This action is irreversible,\ if no error is detected either by this script or by Google Play.') else: log.warning( 'APKs will be submitted to Google Play, but no change will not be committed.' ) else: log.warning( 'This pushapk instance is not allowed to talk to Google Play. *All* requests will be mocked.' )