def test_parse_metadata(self): """Testing parsing the metadata.""" result, _ = self.fs_handler.fetch_metadata() self.assertTrue(result) collections = self.fs_handler.parse_metadata() # There's only 1 collection defined there self.assertEqual(len(collections), 1) expected_collection = { 'status': 0, 'description': u'The collection contains various resources for testing', 'tags': u'test, symbol, svg, processing', 'register_name': u'test_collection', 'repository_url': test_repository_url(), 'name': u"Akbar's Test Collection", 'author': u'Akbar Gumbira', 'author_email': u'*****@*****.**', 'qgis_min_version': u'2.0', 'qgis_max_version': u'3.99', 'license': 'GNU GPL', 'license_url': '%s/collections/test_collection/LICENSE.txt' %test_repository_url(), 'preview': [ '%s/collections/test_collection/preview/prev_1.png' % test_repository_url(), '%s/collections/test_collection/preview/prev_2.png' % test_repository_url() ] } self.assertDictEqual(collections[0], expected_collection)
def test_form_changed(self): """Add form changed test.""" self.assertEqual( self.dialog.buttonBox.button(QDialogButtonBox.Ok).isEnabled(), False) self.dialog.line_edit_name.setText("Repository Name") self.dialog.line_edit_url.setText(test_repository_url()) self.assertEqual( self.dialog.buttonBox.button(QDialogButtonBox.Ok).isEnabled(), True)
def test_form_changed(self): """Add form changed test.""" self.assertEqual( self.dialog.buttonBox.button(QDialogButtonBox.Ok).isEnabled(), False) self.dialog.line_edit_name.setText('Repository Name') self.dialog.line_edit_url.setText(test_repository_url()) self.assertEqual( self.dialog.buttonBox.button(QDialogButtonBox.Ok).isEnabled(), True)
def test_parse_metadata(self): """Testing parsing the metadata.""" result, _ = self.fs_handler.fetch_metadata() self.assertTrue(result) collections = self.fs_handler.parse_metadata() # There's only 1 collection defined there self.assertEqual(len(collections), 1) expected_collection = { 'status': 0, 'description': u'The collection contains various resources for testing', 'tags': u'test, symbol, svg, processing', 'register_name': u'test_collection', 'repository_url': test_repository_url(), 'name': u"Akbar's Test Collection", 'author': u'Akbar Gumbira', 'author_email': u'*****@*****.**', 'qgis_min_version': u'2.0', 'qgis_max_version': u'3.99', 'license': 'GNU GPL', 'license_url': '%s/collections/test_collection/LICENSE.txt' % test_repository_url(), 'preview': [ '%s/collections/test_collection/preview/prev_1.png' % test_repository_url(), '%s/collections/test_collection/preview/prev_2.png' % test_repository_url() ] } self.assertDictEqual(collections[0], expected_collection)
def test_parse_metadata(self): """Testing parsing the metadata.""" result, _ = self.fs_handler.fetch_metadata() self.assertTrue(result) collections = self.fs_handler.parse_metadata() # There's only 1 collection defined there self.assertEqual(len(collections), 1) expected_collection = { "status": 0, "description": u"The collection contains various resources for testing", "tags": u"test, symbol, svg, processing", "register_name": u"test_collection", "repository_url": test_repository_url(), "name": u"Akbar's Test Collection", "author": u"Akbar Gumbira", "author_email": u"*****@*****.**", "qgis_min_version": u"2.0", "qgis_max_version": u"3.99", "license": "GNU GPL", "license_url": "%s/collections/test_collection/LICENSE.txt" % test_repository_url(), "preview": [ "%s/collections/test_collection/preview/prev_1.png" % test_repository_url(), "%s/collections/test_collection/preview/prev_2.png" % test_repository_url(), ], } self.assertDictEqual(collections[0], expected_collection)
def test_get_handler(self): handler = self.base_handler.get_handler(test_repository_url()) self.assertEqual(handler.__class__.__name__, 'FileSystemHandler')
def setUp(self): self.base_handler = BaseRepositoryHandler(test_repository_url()) self.fs_handler = FileSystemHandler(test_repository_url())
def setUp(self): self.fs_handler = FileSystemHandler(test_repository_url())
def test_get_handler(self): handler = self.base_handler.get_handler(test_repository_url()) self.assertTrue(isinstance(handler, FileSystemHandler))