Exemplo n.º 1
0
 def canExecute(self):
     if FireDb is None:
         return (
             False,
             "Dette plugin er afhængigt af API'et til Fikspunktregistret. Se venligst https://github.com/Septima/fire-qgis#installation",
         )
     fire_connection_string = self.settings.value("fire_connection_string")
     if fire_connection_string is None:
         conf_message = "Kan ikke finde konfigurationsfil. Se venligst https://github.com/Kortforsyningen/fire-cli#konfigurationsfil for format og placering af konfigurationsfil"
         return False, conf_message
     else:
         try:
             fireDb = FireDb(fire_connection_string)
             fireDb.hent_observationstyper()
             return True, "OK"
         except Exception as ex:
             str_ex = str(ex)
             fire_connection_file_path = self.settings.value(
                 "fire_connection_file_path")
             return (
                 False,
                 "Fejl i forbindelse til Fikspunktregistret. Se venligst https://github.com/Kortforsyningen/fire-cli#konfigurationsfil for format og indhold af konfigurationsfil.          Exception:["
                 + str_ex + "]  Konfigurationsfil:[" +
                 fire_connection_file_path + "]",
             )
Exemplo n.º 2
0
def test_hent_observationstyper(firedb: FireDb):
    ot = list(firedb.hent_observationstyper())
    assert len(ot) > 1
    assert all([isinstance(x, ObservationsType) for x in ot])