How to use the nose.tools.istest function in nose

To help you get started, we’ve selected a few nose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python-provy / provy / tests / unit / more / debian / package / test_gem.py View on Github external
    @istest
    def installs_a_package_if_its_not_installed_yet_by_name_and_version(self):
        with self.execute_mock() as execute, self.mock_role_method('is_package_installed') as is_package_installed:
            is_package_installed.return_value = False

            self.role.ensure_package_installed('runit', '123')

            execute.assert_called_with('gem install runit(123)', sudo=True, stdout=False)
github diogobaeder / pycket / tests / test_session.py View on Github external
    @istest
    def sets_session_id_on_cookies(self):
        test_case = self

        class StubHandler(SessionMixin):
            settings = {
                'pycket': {
                    'engine': 'redis',
                }
            }

            def get_secure_cookie(self, name):
                test_case.assertEqual(name, 'PYCKET_ID')
                self.cookie_set = True
                return None

            def set_secure_cookie(self, name, value, expires_days, expires):
github python-provy / provy / tests / unit / more / debian / security / test_apparmor.py View on Github external
    @istest
    def creates_a_profile_with_read_and_write_permissions(self):
        with self.execute_mock() as execute:
            self.role.create('/some/bin', read_and_write=['/var/log/somebin.log', '/srv/somebin/'])

            execute.assert_called_with('aa-easyprof -w /var/log/somebin.log -w /srv/somebin/ /some/bin', stdout=False, sudo=True)
github python-provy / provy / tests / unit / more / debian / security / test_iptables.py View on Github external
    @istest
    def installs_necessary_packages_to_provision(self):
        with self.using_stub(AptitudeRole) as aptitude, self.execute_mock():
            self.role.provision()

            aptitude.ensure_package_installed.assert_any_call('iptables')
github mwilliamson / whack / tests / platform_tests.py View on Github external
@istest
def libc_version_is_derived_from_getconf_gnu_libc_version():
    platform = _generate_platform()
    assert_equal(platform.libc, "glibc-2.13")
github python-provy / provy / tests / unit / more / centos / package / test_yum.py View on Github external
    @istest
    def gets_none_as_last_update_if_there_was_no_update_yet(self):
        with self.mock_role_methods('remote_exists', 'update_date_file', 'read_remote_file'):
            self.role.update_date_file = '/foo/bar'
            self.role.remote_exists.return_value = False

            result = self.role.get_last_update_date()

            self.assertIsNone(result)
            self.assertFalse(self.role.read_remote_file.called)
github python-provy / provy / tests / unit / core / test_utils.py View on Github external
    @istest
    def gets_provyfile_path_from_args(self):
        existing_file = 'path/to/provyfile.py'

        with patch.object(os.path, 'exists') as exists:
            exists.return_value = True

            self.assertEqual(provyfile_path_from(args=[existing_file]), existing_file)
github python-provy / provy / tests / unit / core / test_roles.py View on Github external
    @istest
    def schedules_cleanup_when_provisioning(self):
        role_instance = MagicMock()

        def StubRole(prov, context):
            return role_instance

        self.role.provision_role(StubRole)

        role_instance.schedule_cleanup.assert_called_with()
github python-provy / provy / tests / unit / more / debian / database / test_mysql.py View on Github external
    @istest
    def gets_empty_user_hosts(self):
        with self.execute_mock() as execute:
            execute.return_value = ''

            hosts = self.role.get_user_hosts('root')

            self.assertEqual(hosts, [])
            execute.assert_called_with('''mysql -u root -E -e "select Host from mysql.user where LOWER(User)='root'" mysql''',
                                       sudo=True, stdout=False)
github python-provy / provy / tests / unit / more / debian / web / test_nginx.py View on Github external
    @istest
    def restart_if_necessary_upon_cleanup(self):
        self.role.context['must-restart-nginx'] = True

        with self.mock_role_method('restart'):
            self.role.cleanup()

            self.assertTrue(self.role.restart.called)