123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997 |
- # -*- coding: utf-8 -*-
- """
- (c) 2017 - Copyright Red Hat Inc
- Authors:
- Pierre-Yves Chibon <pingou@pingoured.fr>
- """
- __requires__ = ['SQLAlchemy >= 0.8']
- import pkg_resources
- import datetime
- import os
- import shutil
- import sys
- import tempfile
- import time
- import unittest
- import pygit2
- from mock import patch, MagicMock
- sys.path.insert(0, os.path.join(os.path.dirname(
- os.path.abspath(__file__)), '..'))
- import pagure
- import pagure.lib.git
- import tests
- from pagure.lib.repo import PagureRepo
- CORE_CONFIG = """repo test
- R = @all
- RW+ = pingou
- repo docs/test
- R = @all
- RW+ = pingou
- repo tickets/test
- RW+ = pingou
- repo requests/test
- RW+ = pingou
- repo test2
- R = @all
- RW+ = pingou
- repo docs/test2
- R = @all
- RW+ = pingou
- repo tickets/test2
- RW+ = pingou
- repo requests/test2
- RW+ = pingou
- repo somenamespace/test3
- R = @all
- RW+ = pingou
- repo docs/somenamespace/test3
- R = @all
- RW+ = pingou
- repo tickets/somenamespace/test3
- RW+ = pingou
- repo requests/somenamespace/test3
- RW+ = pingou"""
- class PagureLibGitoliteConfigtests(tests.Modeltests):
- """ Tests for pagure.lib.git """
- maxDiff = None
- def setUp(self):
- """ Set up the environnment, ran before every tests. """
- super(PagureLibGitoliteConfigtests, self).setUp()
- tests.create_projects(self.session)
- self.outputconf = os.path.join(self.path, 'test_gitolite.conf')
- self.preconf = os.path.join(self.path, 'header_gitolite')
- with open(self.preconf, 'w') as stream:
- stream.write('# this is a header that is manually added\n')
- stream.write('\n')
- stream.write('@group1 = foo bar baz\n')
- stream.write('@group2 = threebean puiterwijk kevin pingou\n')
- self.postconf = os.path.join(self.path, 'footer_gitolite')
- with open(self.postconf, 'w') as stream:
- stream.write('# end of generated configuration\n')
- stream.write('# \ó/\n')
- stream.write('# end of footer\n')
- def tearDown(self):
- """ Tearn down the environnment, ran before every tests. """
- super(PagureLibGitoliteConfigtests, self).tearDown()
- if os.path.exists(self.outputconf):
- os.unlink(self.outputconf)
- self.assertFalse(os.path.exists(self.outputconf))
- def test_write_gitolite_pre_post_projectNone(self):
- """ Test the write_gitolite_acls function of pagure.lib.git with
- a postconf set """
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=None,
- preconf=self.preconf,
- postconf=self.postconf
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- %s
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """ % CORE_CONFIG
- #print data
- self.assertEqual(data, exp)
- def test_write_gitolite_pre_post_projectNone_to_existing_file(self):
- """ Test the write_gitolite_acls function of pagure.lib.git with
- a postconf set with existing output file """
- with open(self.outputconf, 'w') as stream:
- pass
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=None,
- preconf=self.preconf,
- postconf=self.postconf
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read()
- self.assertEqual(data, '')
- def test_write_gitolite_pre_post_project_1(self):
- """ Test the write_gitolite_acls function of pagure.lib.git with
- a postconf set """
- with open(self.outputconf, 'w') as stream:
- pass
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=-1,
- preconf=self.preconf,
- postconf=self.postconf
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- %s
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """ % CORE_CONFIG
- #print data
- self.assertEqual(data, exp)
- def test_write_gitolite_pre_post_project_test(self):
- """ Test the write_gitolite_acls function of pagure.lib.git with
- a postconf set """
- with open(self.outputconf, 'w') as stream:
- pass
- project = pagure.lib._get_project(self.session, 'test')
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=project,
- preconf=self.preconf,
- postconf=self.postconf
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- repo test
- R = @all
- RW+ = pingou
- repo docs/test
- R = @all
- RW+ = pingou
- repo tickets/test
- RW+ = pingou
- repo requests/test
- RW+ = pingou
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """
- #print data
- self.assertEqual(data, exp)
- def test_write_gitolite_pre_post_project_test_full_file(self):
- """ Test the write_gitolite_acls function of pagure.lib.git with
- a postconf set """
- # Re-generate the gitolite config for all the projects
- self.test_write_gitolite_pre_post_project_1()
- self.assertTrue(os.path.exists(self.outputconf))
- project = pagure.lib._get_project(self.session, 'test')
- project.user_id = 2
- self.session.add(project)
- self.session.commit()
- project = pagure.lib._get_project(self.session, 'test')
- msg = pagure.lib.add_user_to_project(
- self.session,
- project=project,
- new_user='pingou',
- user='foo',
- access='commit'
- )
- self.assertEqual(msg, 'User added')
- self.session.commit()
- project = pagure.lib._get_project(self.session, 'test')
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=project,
- preconf=self.preconf,
- postconf=self.postconf
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- repo test2
- R = @all
- RW+ = pingou
- repo docs/test2
- R = @all
- RW+ = pingou
- repo tickets/test2
- RW+ = pingou
- repo requests/test2
- RW+ = pingou
- repo somenamespace/test3
- R = @all
- RW+ = pingou
- repo docs/somenamespace/test3
- R = @all
- RW+ = pingou
- repo tickets/somenamespace/test3
- RW+ = pingou
- repo requests/somenamespace/test3
- RW+ = pingou
- repo test
- R = @all
- RW+ = foo
- RW+ = pingou
- repo docs/test
- R = @all
- RW+ = foo
- RW+ = pingou
- repo tickets/test
- RW+ = foo
- RW+ = pingou
- repo requests/test
- RW+ = foo
- RW+ = pingou
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """
- #print data
- self.assertEqual(data, exp)
- @patch.dict('pagure.config.config',
- {'ENABLE_DOCS': False, 'ENABLE_TICKETS': False})
- def test_write_gitolite_disabled_docs_tickets(self):
- """ Test the write_gitolite_acls function when docs and tickets
- are disabled """
- # Re-generate the gitolite config for all the projects
- project = pagure.lib._get_project(self.session, 'test')
- project.user_id = 2
- self.session.add(project)
- self.session.commit()
- project = pagure.lib._get_project(self.session, 'test')
- msg = pagure.lib.add_user_to_project(
- self.session,
- project=project,
- new_user='pingou',
- user='foo',
- access='commit'
- )
- self.assertEqual(msg, 'User added')
- self.session.commit()
- project = pagure.lib._get_project(self.session, 'test')
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=project,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = """repo test
- R = @all
- RW+ = foo
- RW+ = pingou
- repo requests/test
- RW+ = foo
- RW+ = pingou
- repo test2
- R = @all
- RW+ = pingou
- repo requests/test2
- RW+ = pingou
- repo somenamespace/test3
- R = @all
- RW+ = pingou
- repo requests/somenamespace/test3
- RW+ = pingou
- # end of body
- """
- self.assertEqual(data, exp)
- class PagureLibGitoliteGroupConfigtests(tests.Modeltests):
- """ Tests for generating the gitolite configuration file for a group
- change
- """
- maxDiff = None
- def setUp(self):
- """ Set up the environnment, ran before every tests. """
- super(PagureLibGitoliteGroupConfigtests, self).setUp()
- pagure.lib.git.SESSION = self.session
- tests.create_projects(self.session)
- pagure.lib.add_group(
- self.session,
- group_name='grp',
- display_name='grp group',
- description=None,
- group_type='user',
- user='pingou',
- is_admin=False,
- blacklist=[],
- )
- pagure.lib.add_group(
- self.session,
- group_name='grp2',
- display_name='grp2 group',
- description=None,
- group_type='user',
- user='foo',
- is_admin=False,
- blacklist=[],
- )
- self.session.commit()
- self.outputconf = os.path.join(self.path, 'test_gitolite.conf')
- self.preconf = os.path.join(self.path, 'header_gitolite')
- with open(self.preconf, 'w') as stream:
- stream.write('# this is a header that is manually added\n')
- stream.write('\n')
- stream.write('@group1 = foo bar baz\n')
- stream.write('@group2 = threebean puiterwijk kevin pingou\n')
- self.postconf = os.path.join(self.path, 'footer_gitolite')
- with open(self.postconf, 'w') as stream:
- stream.write('# end of generated configuration\n')
- stream.write('# \ó/\n')
- stream.write('# end of footer\n')
- def tearDown(self):
- """ Tearn down the environnment, ran before every tests. """
- super(PagureLibGitoliteGroupConfigtests, self).tearDown()
- if os.path.exists(self.outputconf):
- os.unlink(self.outputconf)
- self.assertFalse(os.path.exists(self.outputconf))
- def test_write_gitolite_project_test_group(self):
- """ Test the write_gitolite_acls when updating a single group. """
- with open(self.outputconf, 'w') as stream:
- pass
- project = pagure.lib._get_project(self.session, 'test')
- group = pagure.lib.search_groups(self.session, group_name='grp')
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=project,
- preconf=self.preconf,
- postconf=self.postconf,
- group=group,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- @grp = pingou
- repo test
- R = @all
- RW+ = pingou
- repo docs/test
- R = @all
- RW+ = pingou
- repo tickets/test
- RW+ = pingou
- repo requests/test
- RW+ = pingou
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """
- #print data
- self.assertEqual(data, exp)
- def test_write_gitolite_project_test_all_groups(self):
- """ Test the write_gitolite_acls when updating all groups. """
- with open(self.outputconf, 'w') as stream:
- pass
- project = pagure.lib._get_project(self.session, 'test')
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=project,
- preconf=self.preconf,
- postconf=self.postconf,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- @grp = pingou
- @grp2 = foo
- # end of groups
- repo test
- R = @all
- RW+ = pingou
- repo docs/test
- R = @all
- RW+ = pingou
- repo tickets/test
- RW+ = pingou
- repo requests/test
- RW+ = pingou
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """
- #print data
- self.assertEqual(data, exp)
- def test_write_gitolite_project_all_projects_groups(self):
- """ Test the generating the entire gitolite config. """
- with open(self.outputconf, 'w') as stream:
- pass
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=-1,
- preconf=self.preconf,
- postconf=self.postconf,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- @grp = pingou
- @grp2 = foo
- # end of groups
- %s
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """ % CORE_CONFIG
- #print data
- self.assertEqual(data, exp)
- def test_write_gitolite_project_all_projects_one_group(self):
- """ Test the generating the entire gitolite config. """
- # Generate the full gitolite config that we will update
- self.test_write_gitolite_project_all_projects_groups()
- project = pagure.lib._get_project(self.session, 'test')
- group = pagure.lib.search_groups(self.session, group_name='grp')
- # Let's add `foo` to `grp` so something changes
- msg = pagure.lib.add_user_to_group(
- self.session,
- username='foo',
- group=group,
- user='pingou',
- is_admin=False,
- )
- self.session.commit()
- self.assertEqual(msg, 'User `foo` added to the group `grp`.')
- # Let's add `foo` to `test` so the project changes as well
- msg = pagure.lib.add_user_to_project(
- self.session,
- project=project,
- new_user='foo',
- user='pingou',
- access='commit'
- )
- self.assertEqual(msg, 'User added')
- self.session.commit()
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=project,
- group=group,
- preconf=self.preconf,
- postconf=self.postconf,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- @grp = foo pingou
- @grp2 = foo
- # end of groups
- repo test2
- R = @all
- RW+ = pingou
- repo docs/test2
- R = @all
- RW+ = pingou
- repo tickets/test2
- RW+ = pingou
- repo requests/test2
- RW+ = pingou
- repo somenamespace/test3
- R = @all
- RW+ = pingou
- repo docs/somenamespace/test3
- R = @all
- RW+ = pingou
- repo tickets/somenamespace/test3
- RW+ = pingou
- repo requests/somenamespace/test3
- RW+ = pingou
- repo test
- R = @all
- RW+ = pingou
- RW+ = foo
- repo docs/test
- R = @all
- RW+ = pingou
- RW+ = foo
- repo tickets/test
- RW+ = pingou
- RW+ = foo
- repo requests/test
- RW+ = pingou
- RW+ = foo
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """
- #print data
- self.assertEqual(data, exp)
- def test_write_gitolite_delete_group(self):
- """ Test the updating the gitolite config after having
- deleted a group.
- """
- # Generate the full gitolite config that we will update
- self.test_write_gitolite_project_all_projects_groups()
- # Delete the group `grp`
- self.assertEqual(len(pagure.lib.search_groups(self.session)), 2)
- group = pagure.lib.search_groups(self.session, group_name='grp')
- self.session.delete(group)
- self.session.commit()
- self.assertEqual(len(pagure.lib.search_groups(self.session)), 1)
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=None,
- preconf=self.preconf,
- postconf=self.postconf,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""# this is a header that is manually added
- @group1 = foo bar baz
- @group2 = threebean puiterwijk kevin pingou
- # end of header
- @grp2 = foo
- # end of groups
- %s
- # end of body
- # end of generated configuration
- # \ó/
- # end of footer
- """ % CORE_CONFIG
- #print data
- self.assertEqual(data, exp)
- @patch('pagure.lib.git_auth.get_git_auth_helper')
- def test_task_generate_gitolite_acls_one_group(self, get_helper):
- """ Test the generate_gitolite_acls task to ensure if group is None
- then None is passed to the helper. """
- helper = MagicMock()
- get_helper.return_value = helper
- pagure.lib.SESSIONMAKER = self.session.session_factory
- pagure.lib.tasks.generate_gitolite_acls(
- namespace=None, name='test', user=None, group=None)
- get_helper.assert_called_with('gitolite3')
- args = helper.generate_acls.call_args
- self.assertIsNone(args[1].get('group'))
- self.assertIsNotNone(args[1].get('project'))
- def test_write_gitolite_project_test_private(self):
- """ Test the write_gitolite_acls function of pagure.lib.git with
- a postconf set """
- # Make the test project private
- project = pagure.lib._get_project(self.session, 'test')
- project.private = True
- self.session.add(project)
- self.session.commit()
- # Re-generate the gitolite config just for this project
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=None,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""@grp = pingou
- @grp2 = foo
- # end of groups
- repo test
- RW+ = pingou
- repo docs/test
- RW+ = pingou
- repo tickets/test
- RW+ = pingou
- repo requests/test
- RW+ = pingou
- repo test2
- R = @all
- RW+ = pingou
- repo docs/test2
- R = @all
- RW+ = pingou
- repo tickets/test2
- RW+ = pingou
- repo requests/test2
- RW+ = pingou
- repo somenamespace/test3
- R = @all
- RW+ = pingou
- repo docs/somenamespace/test3
- R = @all
- RW+ = pingou
- repo tickets/somenamespace/test3
- RW+ = pingou
- repo requests/somenamespace/test3
- RW+ = pingou
- # end of body
- """
- #print data
- self.assertEqual(data, exp)
- def test_remove_acls(self):
- """ Test the remove_acls function of pagure.lib.git when deleting
- a project """
- pagure.config.config['GITOLITE_CONFIG'] = self.outputconf
- with open(self.outputconf, 'w') as stream:
- pass
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=-1,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""@grp = pingou
- @grp2 = foo
- # end of groups
- %s
- # end of body
- """ % CORE_CONFIG
- #print data
- self.assertEqual(data, exp)
- # Test removing a project from the existing config
- project = pagure.lib.get_authorized_project(
- self.session, project_name='test')
- helper.remove_acls(self.session, project=project)
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""@grp = pingou
- @grp2 = foo
- # end of groups
- repo test2
- R = @all
- RW+ = pingou
- repo docs/test2
- R = @all
- RW+ = pingou
- repo tickets/test2
- RW+ = pingou
- repo requests/test2
- RW+ = pingou
- repo somenamespace/test3
- R = @all
- RW+ = pingou
- repo docs/somenamespace/test3
- R = @all
- RW+ = pingou
- repo tickets/somenamespace/test3
- RW+ = pingou
- repo requests/somenamespace/test3
- RW+ = pingou
- # end of body
- """
- #print data
- self.assertEqual(data, exp)
- def test_remove_acls_no_project(self):
- """ Test the remove_acls function of pagure.lib.git when no project
- is specified """
- pagure.config.config['GITOLITE_CONFIG'] = self.outputconf
- with open(self.outputconf, 'w') as stream:
- pass
- helper = pagure.lib.git_auth.get_git_auth_helper('gitolite3')
- helper.write_gitolite_acls(
- self.session,
- self.outputconf,
- project=-1,
- )
- self.assertTrue(os.path.exists(self.outputconf))
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- exp = u"""@grp = pingou
- @grp2 = foo
- # end of groups
- %s
- # end of body
- """ % CORE_CONFIG
- #print data
- self.assertEqual(data, exp)
- # Test nothing changes if no project is specified
- self.assertRaises(
- RuntimeError,
- helper.remove_acls,
- self.session,
- project=None
- )
- with open(self.outputconf) as stream:
- data = stream.read().decode('utf-8')
- self.assertEqual(data, exp)
- if __name__ == '__main__':
- unittest.main(verbosity=2)
|