Ejemplo n.º 1
0
    def test_one_file(self, fake_open):
        'test passwdx set back to one file'
        conf = FakeFile()
        fake_open.return_value = conf

        reload(gitbuildsys.conf)

        self.assertEquals('''[remotebuild]
build_server = https://api
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s

[build]
repo1.url = https://repo1
repo1.passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
''', conf.getvalue())
Ejemplo n.º 2
0
    def test_one_file(self, fake_open):
        'test passwdx set back to one file'
        conf = FakeFile()
        fake_open.return_value = conf

        reload(gitbuildsys.conf)

        self.assertEquals(
            '''[remotebuild]
build_server = https://api
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s

[build]
repo1.url = https://repo1
repo1.passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
''', conf.getvalue())
Ejemplo n.º 3
0
    def test_auto_generate_conf(self, fake_open, _fake_chmod):
        'test auto generate conf should contain obs and repos'
        conf = FakeFile()
        fake_open.return_value = conf

        reload(gitbuildsys.conf)

        parser = BrainConfigParser()
        parser.readfp(StringIO(conf.getvalue()))

        name = parser.get('general', 'profile')
        obs = parser.get(name, 'obs')
        repos = parser.get(name, 'repos')

        self.assertTrue(parser.has_section(obs))
        for repo in repos.split(','):
            self.assertTrue(parser.has_section(repo.strip()))
Ejemplo n.º 4
0
    def test_auto_generate_conf(self, fake_open, _fake_chmod):
        'test auto generate conf should contain obs and repos'
        conf = FakeFile()
        fake_open.return_value = conf

        reload(gitbuildsys.conf)

        parser = BrainConfigParser()
        parser.readfp(StringIO(conf.getvalue()))

        name = parser.get('general', 'profile')
        obs = parser.get(name, 'obs')
        repos = parser.get(name, 'repos')

        self.assertTrue(parser.has_section(obs))
        for repo in repos.split(','):
            self.assertTrue(parser.has_section(repo.strip()))
Ejemplo n.º 5
0
    def test_convert(self, fake_open):
        "test convert"
        conf = FakeFile()
        fake_open.return_value = conf

        get_profile()

        self.assertEquals(
            conf.getvalue(),
            """[general]
profile = profile.current

[obs.remotebuild]
url = https://api/build/server
user = Alice
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
base_prj = Main
target_prj = Target

[repo.repo1]
url = https://repo1/path
user = Alice
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s

[repo.repo2]
url = https://repo2/path
user = Alice
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s

[repo.repo3]
url = /local/path/repo

[profile.current]
obs = obs.remotebuild
repos = repo.repo1, repo.repo2, repo.repo3

""",
        )
Ejemplo n.º 6
0
    def test_convert(self, fake_open):
        'test convert'
        conf = FakeFile()
        fake_open.return_value = conf

        get_profile()

        self.assertEquals(
            conf.getvalue(), '''[general]
profile = profile.current

[obs.remotebuild]
url = https://api/build/server
user = Alice
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
base_prj = Main
target_prj = Target

[repo.repo1]
url = https://repo1/path
user = Alice
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s

[repo.repo2]
url = https://repo2/path
user = Alice
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s

[repo.repo3]
url = /local/path/repo

[profile.current]
obs = obs.remotebuild
repos = repo.repo1, repo.repo2, repo.repo3

''')