예제 #1
0
 def test_import_libraries_append_mode(self):
     with responses.RequestsMock() as rsps:
         rfhub_importer = RfhubImporter(
             self.client, (self.fixture_path / "LibWithInit", ),
             True,
             mode="append")
         rsps.add(
             responses.POST,
             f"{self.client.api_url}/collections/",
             json={
                 "name": "LibWithInit",
                 "id": 2
             },
             status=201,
             adding_headers={
                 "Content-Type": "application/json",
                 "accept": "application/json",
             },
         )
         rsps.add(
             responses.POST,
             f"{self.client.api_url}/keywords/",
             json=KEYWORDS_2,
             status=201,
             adding_headers={
                 "Content-Type": "application/json",
                 "accept": "application/json",
             },
         )
         result = rfhub_importer.import_libraries()
         self.assertCountEqual(result, (1, 4), msg=f"{result}")
예제 #2
0
 def test_get_libraries_paths_should_return_set_of_paths_when_paths_are_tuple(self):
     self.rfhub_importer = RfhubImporter(
         self.client,
         (
             self.fixture_path / "LibWithInit",
             self.fixture_path / "LibsWithEmptyInit",
         ),
         True,
     )
     result = self.rfhub_importer.get_libraries_paths()
     self.assertEqual(
         result, EXPECTED_TRAVERSE_PATHS_INIT | EXPECTED_TRAVERSE_PATHS_NO_INIT
     )
예제 #3
0
def main(
    app_url: str,
    user: str,
    password: str,
    paths: Tuple[Path, ...],
    mode: str,
    no_installed_keywords: bool,
) -> None:
    """Package to populate rfhub2 with robot framework keywords
       from libraries and resource files."""
    client = Client(app_url, user, password)
    rfhub_importer = RfhubImporter(client, paths, no_installed_keywords, mode)
    loaded_collections, loaded_keywords = rfhub_importer.import_libraries()
    print(
        f"\nSuccessfully loaded {loaded_collections} collections with {loaded_keywords} keywords."
    )
예제 #4
0
 def test_get_libraries_paths_should_return_set_of_paths_on_installed_keywords(
         self):
     self.rfhub_importer = RfhubImporter(self.client, tuple(), False, False)
     result = self.rfhub_importer.get_libraries_paths()
     self.assertEqual(result, EXPECTED_BUILT_IN_LIBS)
예제 #5
0
 def setUp(self) -> None:
     self.fixture_path = FIXTURE_PATH
     self.client = Client("http://localhost:8000", "rfhub", "rfhub")
     self.rfhub_importer = RfhubImporter(self.client, (self.fixture_path, ),
                                         True,
                                         mode="insert")