Пример #1
0
 def test_package6(self):
     """test package validation (invalid model)"""
     RemotePackage.SCHEMA = self.fixture_file('package_simple.xsd')
     pkg = RemotePackage('foo', 'bar')
     pkg.set('invalidattr', 'yes')
     self.assertRaises(etree.DocumentInvalid, pkg.validate)
     self.assertRaises(etree.DocumentInvalid, pkg.store)
Пример #2
0
 def test_package6(self):
     """test package validation (invalid model)"""
     RemotePackage.SCHEMA = self.fixture_file('package_simple.xsd')
     pkg = RemotePackage('foo', 'bar')
     pkg.set('invalidattr', 'yes')
     self.assertRaises(etree.DocumentInvalid, pkg.validate)
     self.assertRaises(etree.DocumentInvalid, pkg.store)
Пример #3
0
 def test_package8(self):
     """test package validation (invalid xml response after store)"""
     RemotePackage.SCHEMA = self.fixture_file('package_simple.xsd')
     RemotePackage.PUT_RESPONSE_SCHEMA = self.fixture_file('ok_simple.xsd')
     pkg = RemotePackage('foo', 'bar')
     # check that validation is ok
     pkg.validate()
     self.assertRaises(etree.DocumentInvalid, pkg.store)
Пример #4
0
 def test_package8(self):
     """test package validation (invalid xml response after store)"""
     RemotePackage.SCHEMA = self.fixture_file('package_simple.xsd')
     RemotePackage.PUT_RESPONSE_SCHEMA = self.fixture_file('ok_simple.xsd')
     pkg = RemotePackage('foo', 'bar')
     # check that validation is ok
     pkg.validate()
     self.assertRaises(etree.DocumentInvalid, pkg.store)
Пример #5
0
 def _commit_deletes(self, cstate):
     cinfo = cstate.info
     for package in cinfo.deleted:
         if cstate.state == CommitStateMixin.STATE_TRANSFER:
             RemotePackage.delete(self.name, package, apiurl=self.apiurl)
             cstate.state = CommitStateMixin.STATE_COMMITTING
         self._remove_wc_dir(package, notify=True)
         cstate.processed(package, None)
         self.notifier.processed(package, None, 'D')
Пример #6
0
 def _commit_deletes(self, cstate):
     cinfo = cstate.info
     for package in cinfo.deleted:
         if cstate.state == CommitStateMixin.STATE_TRANSFER:
             RemotePackage.delete(self.name, package, apiurl=self.apiurl)
             cstate.state = CommitStateMixin.STATE_COMMITTING
         self._remove_wc_dir(package, notify=True)
         cstate.processed(package, None)
         self.notifier.processed(package, None, 'D')
Пример #7
0
    def real_obj(self):
        """Returns a "real" Request object.

        The returned object is "writable" too that is
        its state can be changed etc.

        """
        return RemotePackage(xml_data=etree.tostring(self))
Пример #8
0
 def test_package2(self):
     """create a remote package"""
     pkg = RemotePackage('openSUSE:Tools', 'osc')
     debug = pkg.add_debuginfo()
     debug.add_disable()
     debug.add_enable(repository='openSUSE_Factory')
     debug.add_enable(repository='some_repo', arch='i586')
     pkg.title = 'tiny title'
     pkg.description = 'some useless\ndescription...'
     # modify person afterwards
     person = pkg.add_person(userid='wrongid', role='maintainer')
     person.set('userid', 'foobar')
     pkg.store()
Пример #9
0
 def test_package3(self):
     """get, modify, store remote package"""
     pkg = RemotePackage.find('openSUSE:Tools', 'osc')
     # remove debuginfo element
     del pkg.debuginfo
     # add build element
     build = pkg.add_build()
     build.add_enable(arch='x86_64')
     build.add_disable(arch='i586')
     # add devel element
     pkg.add_devel(project='openSUSE:Factory', package='osc')
     pkg.store()
Пример #10
0
 def test_package3(self):
     """get, modify, store remote package"""
     pkg = RemotePackage.find('openSUSE:Tools', 'osc')
     # remove debuginfo element
     del pkg.debuginfo
     # add build element
     build = pkg.add_build()
     build.add_enable(arch='x86_64')
     build.add_disable(arch='i586')
     # add devel element
     pkg.add_devel(project='openSUSE:Factory', package='osc')
     pkg.store()
Пример #11
0
 def test_package2(self):
     """create a remote package"""
     pkg = RemotePackage('openSUSE:Tools', 'osc')
     debug = pkg.add_debuginfo()
     debug.add_disable()
     debug.add_enable(repository='openSUSE_Factory')
     debug.add_enable(repository='some_repo', arch='i586')
     pkg.title = 'tiny title'
     pkg.description = 'some useless\ndescription...'
     # modify person afterwards
     person = pkg.add_person(userid='wrongid', role='maintainer')
     person.set('userid', 'foobar')
     pkg.store()
Пример #12
0
 def test_package1(self):
     """get a remote package"""
     pkg = RemotePackage.find('openSUSE:Tools', 'osc')
     self.assertEqual(pkg.get('project'), 'openSUSE:Tools')
     self.assertEqual(pkg.get('name'), 'osc')
     self.assertEqual(pkg.title, 'tiny title')
     self.assertEqual(pkg.description, 'some useless\ndescription...')
     self.assertIsNotNone(pkg.debuginfo.disable)
     self.assertIsNotNone(pkg.debuginfo.disable[0])
     self.assertEqual(pkg.debuginfo.enable[0].get('repository'),
                      'openSUSE_Factory')
     self.assertEqual(pkg.debuginfo.enable[1].get('repository'),
                      'some_repo')
     self.assertEqual(pkg.debuginfo.enable[1].get('arch'), 'i586')
     self.assertEqual(pkg.person.get('userid'), 'foobar')
     self.assertEqual(pkg.person.get('role'), 'maintainer')
Пример #13
0
 def test_package1(self):
     """get a remote package"""
     pkg = RemotePackage.find('openSUSE:Tools', 'osc')
     self.assertEqual(pkg.get('project'), 'openSUSE:Tools')
     self.assertEqual(pkg.get('name'), 'osc')
     self.assertEqual(pkg.title, 'tiny title')
     self.assertEqual(pkg.description, 'some useless\ndescription...')
     self.assertIsNotNone(pkg.debuginfo.disable)
     self.assertIsNotNone(pkg.debuginfo.disable[0])
     self.assertEqual(pkg.debuginfo.enable[0].get('repository'),
                      'openSUSE_Factory')
     self.assertEqual(pkg.debuginfo.enable[1].get('repository'),
                      'some_repo')
     self.assertEqual(pkg.debuginfo.enable[1].get('arch'), 'i586')
     self.assertEqual(pkg.person.get('userid'), 'foobar')
     self.assertEqual(pkg.person.get('role'), 'maintainer')
Пример #14
0
 def _commit_adds(self, cstate, package_filenames, comment):
     cinfo = cstate.info
     tl = self.notifier.listener
     for package in cinfo.added:
         if cstate.state == CommitStateMixin.STATE_TRANSFER:
             # check if package was created in the meantime
             exists = RemotePackage.exists(self.name, package,
                                           apiurl=self.apiurl)
             if not exists:
                 pkg = RemotePackage(self.name, package)
                 pkg.store(apiurl=self.apiurl)
             pkg = self.package(package, transaction_listener=tl)
             filenames = package_filenames.get(package, [])
             pkg.commit(*filenames, comment=comment)
             cstate.state = CommitStateMixin.STATE_COMMITTING
         cstate.processed(package, ' ')
         self.notifier.processed(package, ' ', 'A')
Пример #15
0
 def _commit_adds(self, cstate, package_filenames, comment):
     cinfo = cstate.info
     tl = self.notifier.listener
     for package in cinfo.added:
         if cstate.state == CommitStateMixin.STATE_TRANSFER:
             # check if package was created in the meantime
             exists = RemotePackage.exists(self.name, package,
                                           apiurl=self.apiurl)
             if not exists:
                 pkg = RemotePackage(self.name, package)
                 pkg.store(apiurl=self.apiurl)
             pkg = self.package(package, transaction_listener=tl)
             filenames = package_filenames.get(package, [])
             pkg.commit(*filenames, comment=comment)
             cstate.state = CommitStateMixin.STATE_COMMITTING
         cstate.processed(package, ' ')
         self.notifier.processed(package, ' ', 'A')
Пример #16
0
 def test_package12(self):
     """test delete method"""
     self.assertFalse(RemotePackage.delete('foo', 'bar'))
Пример #17
0
 def test_package10(self):
     """test exists method"""
     self.assertFalse(RemotePackage.exists('newprj', 'foo'))
Пример #18
0
 def test_package12(self):
     """test delete method"""
     self.assertFalse(RemotePackage.delete('foo', 'bar'))
Пример #19
0
 def test_package4(self):
     """test package validation"""
     RemotePackage.SCHEMA = self.fixture_file('package_simple.xsd')
     pkg = RemotePackage.find('foo', 'bar')
     pkg.set('project', 'newprj')
     pkg.store()
Пример #20
0
 def test_package9(self):
     """test exists method"""
     self.assertTrue(RemotePackage.exists('newprj', 'bar'))
Пример #21
0
 def test_package5(self):
     """test package validation"""
     RemotePackage.SCHEMA = self.fixture_file('package_simple.xsd')
     RemotePackage.PUT_RESPONSE_SCHEMA = self.fixture_file('ok_simple.xsd')
     pkg = RemotePackage('newprj', 'bar')
     pkg.store()
Пример #22
0
 def test_package5(self):
     """test package validation"""
     RemotePackage.SCHEMA = self.fixture_file('package_simple.xsd')
     RemotePackage.PUT_RESPONSE_SCHEMA = self.fixture_file('ok_simple.xsd')
     pkg = RemotePackage('newprj', 'bar')
     pkg.store()
Пример #23
0
 def test_package4(self):
     """test package validation"""
     RemotePackage.SCHEMA = self.fixture_file('package_simple.xsd')
     pkg = RemotePackage.find('foo', 'bar')
     pkg.set('project', 'newprj')
     pkg.store()
Пример #24
0
 def test_package9(self):
     """test exists method"""
     self.assertTrue(RemotePackage.exists('newprj', 'bar'))
Пример #25
0
 def test_package10(self):
     """test exists method"""
     self.assertFalse(RemotePackage.exists('newprj', 'foo'))