Repository: packit/packit
Issue: path_or_url: argument should really override the default

I ran this command in packit's working dir:
```
$ packit create-update --dist-git-branch f29 https://github.com/packit-service/ogr
```

I wanted packit to handle ogr but instead it worked with packit:
```
Cloning repo: https://github.com/packit-service/ogr -> /tmp/tmpjiwjrjea
Koji builds for package packit and koji tag f29-updates-candidate:
 - packit-0.1.0-1.fc29
Cloning repo: https://src.fedoraproject.org/rpms/packit.git -> /tmp/tmpn18ix361
Password:
ERROR    Update for packit-0.1.0-1.fc29 already exists
Invalid tag: packit-0.1.0-1.fc29 not tagged with any of the following tags ['f22-updates-candidate', 'f21-updates-candidate', 'f25-updates-candidate', 'f24-updates-candidate', 'f23-updates-candidate', 'f28-updates-candidate', 'f26-updates-candidate', 'dist-6E-epel-testing-candidate', 'epel7-testing-candidate', 'dist-5E-epel-testing-candidate',
'f27-modular-updates-candidate', 'f28-modular-updates-candidate', 'f29-updates-candidate', 'f29-modular-updates-candidate', 'f29-container-updates-candidate', 'f28-container-updates-candidate', 'f29-flatpak-updates-candidate', 'f27-updates-candidate', 'f30-updates-candidate', 'f30-modular-updates-candidate']                                    
ERROR    There is a problem with creating the bodhi update:
Update for packit-0.1.0-1.fc29 already exists
Invalid tag: packit-0.1.0-1.fc29 not tagged with any of the following tags ['f22-updates-candidate', 'f21-updates-candidate', 'f25-updates-candidate', 'f24-updates-candidate', 'f23-updates-candidate', 'f28-updates-candidate', 'f26-updates-candidate', 'dist-6E-epel-testing-candidate', 'epel7-testing-candidate', 'dist-5E-epel-testing-candidate',
'f27-modular-updates-candidate', 'f28-modular-updates-candidate', 'f29-updates-candidate', 'f29-modular-updates-candidate', 'f29-container-updates-candidate', 'f28-container-updates-candidate', 'f29-flatpak-updates-candidate', 'f27-updates-candidate', 'f30-updates-candidate', 'f30-modular-updates-candidate'] 
```

Changed files:
packit/constants.py, tests/unit/test_utils.py, tests/conftest.py, tests/unit/test_local_project.py, packit/cli/types.py, packit/local_project.py, packit/cli/utils.py, packit/distgit.py, tests/integration/test_update.py, tests/integration/test_upstream.py, packit/upstream.py, packit/utils.py, tests/integration/test_create_update.py, tests/integration/test_build.py

diff --git a/packit/cli/types.py b/packit/cli/types.py
index c0ad5f50..2cc52ac5 100644
--- a/packit/cli/types.py
+++ b/packit/cli/types.py
@@ -19,10 +19,15 @@
 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
+import logging
+import os
 
 import click
 
 from packit.local_project import LocalProject
+from packit.utils import is_str_url
+
+logger = logging.getLogger(__name__)
 
 
 class LocalProjectParameter(click.ParamType):
@@ -55,9 +60,21 @@ class LocalProjectParameter(click.ParamType):
                             branch_name = param.default
             remote_name = ctx.params.get(self.remote_param_name, None)
 
-            local_project = LocalProject(
-                path_or_url=value, ref=branch_name, remote=remote_name
-            )
+            if os.path.isdir(value):
+                logger.info(f"Input is a directory: {value}")
+                local_project = LocalProject(
+                    working_dir=value, ref=branch_name, remote=remote_name
+                )
+            elif is_str_url(value):
+                logger.info(f"Input is a URL to a git repo: {value}")
+                local_project = LocalProject(
+                    git_url=value, ref=branch_name, remote=remote_name
+                )
+            else:
+                self.fail(
+                    "Provided input path_or_url is not a directory nor an URL of a git repo."
+                )
+
             if not local_project.working_dir and not local_project.git_url:
                 self.fail(
                     "Parameter is not an existing directory nor correct git url.",
diff --git a/packit/cli/utils.py b/packit/cli/utils.py
index 99dcb596..3fc56442 100644
--- a/packit/cli/utils.py
+++ b/packit/cli/utils.py
@@ -106,7 +106,7 @@ def get_packit_api(
     Load the package config, set other options and return the PackitAPI
     """
     package_config = get_local_package_config(
-        local_project.working_dir, try_local_dir_first=True
+        local_project.working_dir, try_local_dir_last=True
     )
 
     if dist_git_path:
diff --git a/packit/constants.py b/packit/constants.py
index 50f0d169..a3c664da 100644
--- a/packit/constants.py
+++ b/packit/constants.py
@@ -31,12 +31,7 @@ CONFIG_FILE_NAMES = [
     "packit.json",
 ]
 
-COMMON_ARCHIVE_EXTENSIONS = [
-    ".tar.gz",
-    ".tar.bz2",
-    ".tar.xz",
-    ".zip",
-]
+COMMON_ARCHIVE_EXTENSIONS = [".tar.gz", ".tar.bz2", ".tar.xz", ".zip"]
 
 # fedmsg topics
 URM_NEW_RELEASE_TOPIC = "org.release-monitoring.prod.anitya.project.version.update"
diff --git a/packit/distgit.py b/packit/distgit.py
index 8beb17eb..a7306024 100644
--- a/packit/distgit.py
+++ b/packit/distgit.py
@@ -80,7 +80,6 @@ class DistGit(PackitRepositoryBase):
                 git_url=self.dist_git_url,
                 namespace=self.dist_git_namespace,
                 repo_name=self.package_name,
-                path_or_url=self.package_config.downstream_project_url,
                 git_service=PagureService(
                     token=self.pagure_user_token,
                     instance_url=self.package_config.dist_git_base_url,
diff --git a/packit/local_project.py b/packit/local_project.py
index 13bf90e6..6729c7d4 100644
--- a/packit/local_project.py
+++ b/packit/local_project.py
@@ -21,17 +21,14 @@
 # SOFTWARE.
 
 import logging
-import os
 import shutil
 from contextlib import contextmanager
 from typing import Optional, Union
 
 import git
-
-from urllib.parse import urlparse
 from ogr.abstract import GitProject, GitService
-from packit.exceptions import PackitException
 
+from packit.exceptions import PackitException
 from packit.utils import (
     is_git_repo,
     get_repo,
@@ -56,8 +53,6 @@ class LocalProject:
     - full_name: "$namespace/$repo"
     - namespace: namespace of the remote project
     - repo_name: name of the remote project
-    - path_or_url: working_dir if the directory exists
-                    and git_url if the request is valid
 
 
     Local project can compute other attributes if it is possible.
@@ -75,7 +70,6 @@ class LocalProject:
         full_name: str = "",
         namespace: str = "",
         repo_name: str = "",
-        path_or_url: str = "",
         offline: bool = False,
         refresh: bool = True,
         remote: str = "",
@@ -92,20 +86,12 @@ class LocalProject:
         :param full_name: str ("$namespace/$repo")
         :param namespace: str (namespace of the remote project)
         :param repo_name: str (name of the remote project)
-        :param path_or_url: str (used as working_dir if it is an existing directory,
-                                used as git_url if the it is a request-able url)
         :param offline: bool (do not use any network action, defaults to False)
         :param refresh: bool (calculate the missing attributes, defaults to True)
         :param remote: name of the git remote to use
         :param pr_id: ID of the pull request to fetch and check out
         """
         self.working_dir_temporary = False
-        if path_or_url:
-            if os.path.isdir(path_or_url):
-                working_dir = working_dir or path_or_url
-            elif not offline and self._is_url(path_or_url):
-                git_url = git_url or path_or_url
-
         self.git_repo: git.Repo = git_repo
         self.working_dir: str = working_dir
         self._ref = ref
@@ -185,23 +171,6 @@ class LocalProject:
             )
             self.git_repo.git.checkout(current_head)
 
-    def _is_url(self, path_or_url):
-        if urlparse(path_or_url).scheme:
-            url = urlparse(path_or_url)
-            logger.debug(f"Url {path_or_url} parsed. Resulting scheme: {url.scheme}")
-            return True
-        elif path_or_url.startswith("git@"):
-            url = urlparse(
-                path_or_url.replace(":", "/", 1).replace("git@", "git+ssh://", 1)
-            )
-            logger.debug(f"SSH style url {path_or_url} found.")
-            logger.debug(
-                f"Url parsed after replacing with {url.geturl()}. Resulting scheme: {url.scheme}"
-            )
-            return True
-        logger.warning("path_or_url is nor directory nor url")
-        return False
-
     def _parse_repo_name_full_name_and_namespace(self):
         change = False
         if self.repo_name and self.namespace and not self.full_name:
diff --git a/packit/upstream.py b/packit/upstream.py
index 2aa2a5c2..c295fd26 100644
--- a/packit/upstream.py
+++ b/packit/upstream.py
@@ -426,7 +426,8 @@ class Upstream(PackitRepositoryBase):
             # can be different from Spec version. Replace it to ensure proper match.
             base = base.replace(self.specfile.get_version(), version)
             if base.startswith(archive_basename):
-                return base[len(archive_basename):]
+                archive_basename_len = len(archive_basename)
+                return base[archive_basename_len:]
         return ".tar.gz"
 
     def create_archive(self, version: str = None):
@@ -451,7 +452,9 @@ class Upstream(PackitRepositoryBase):
                     raise PackitException(
                         "The target archive doesn't use a common extension ({}), "
                         "git archive can't be used. Please provide your own script "
-                        "for archive creation.".format(", ".join(COMMON_ARCHIVE_EXTENSIONS))
+                        "for archive creation.".format(
+                            ", ".join(COMMON_ARCHIVE_EXTENSIONS)
+                        )
                     )
                 archive_name = f"{dir_name}{archive_extension}"
                 archive_cmd = [
diff --git a/packit/utils.py b/packit/utils.py
index 5f45de1e..e5805b15 100644
--- a/packit/utils.py
+++ b/packit/utils.py
@@ -29,6 +29,7 @@ import tempfile
 from contextlib import contextmanager
 from pathlib import Path
 from typing import Tuple, Any
+from urllib.parse import urlparse
 
 import git
 
@@ -262,3 +263,19 @@ def rpmdev_bumpspec(
         cmd += [f"--file={changelog_file}"]
     cmd += [str(specfile_path)]
     run_command(cmd)
+
+
+def is_str_url(inp: str) -> bool:
+    """ is provided string a URL? """
+    if not inp:
+        return False
+    parsed = urlparse(inp)
+    if parsed.scheme:
+        logger.debug(f"Provided input {inp} is an url, scheme: {parsed.scheme}")
+        return True
+    elif inp.startswith("git@"):
+        url = urlparse(inp.replace(":", "/", 1).replace("git@", "git+ssh://", 1))
+        logger.debug(f"SSH style url {url} found.")
+        return True
+    logger.warning(f"{inp} is not an URL we recognize")
+    return False
diff --git a/tests/conftest.py b/tests/conftest.py
index e2432ce1..55a7d3be 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -26,6 +26,7 @@ import shutil
 import subprocess
 from os import chdir
 from pathlib import Path
+from typing import Tuple
 
 import pytest
 from flexmock import flexmock
@@ -99,7 +100,7 @@ def mock_spec_download_remote_s(path: Path):
     flexmock(SpecFile, download_remote_sources=mock_download_remote_sources)
 
 
-def mock_remote_functionality(distgit, upstream):
+def mock_remote_functionality(distgit: Path, upstream: Path):
     def mocked_pr_create(*args, **kwargs):
         return PullRequest(
             title="",
@@ -136,12 +137,18 @@ def mock_remote_functionality(distgit, upstream):
 
     mock_spec_download_remote_s(distgit)
 
+    dglp = LocalProject(
+        working_dir=str(distgit),
+        git_url="https://packit.dev/rpms/beer",
+        git_service=PagureService(),
+    )
     flexmock(
         DistGit,
         push_to_fork=lambda *args, **kwargs: None,
         # let's not hammer the production lookaside cache webserver
         is_archive_in_lookaside_cache=lambda archive_path: False,
         build=lambda scratch: None,
+        local_project=dglp,
     )
 
     def mocked_new_sources(sources=None):
@@ -162,7 +169,7 @@ def mock_patching():
 
 
 @pytest.fixture()
-def upstream_distgit_remote(tmpdir):
+def upstream_distgit_remote(tmpdir) -> Tuple[Path, Path, Path]:
     t = Path(str(tmpdir))
 
     u_remote = t / "upstream_remote"
@@ -239,7 +246,7 @@ def upstream_instance(upstream_n_distgit, tmpdir):
         pc = get_local_package_config(str(u))
         pc.upstream_project_url = str(u)
         pc.downstream_project_url = str(d)
-        lp = LocalProject(path_or_url=str(u))
+        lp = LocalProject(working_dir=str(u))
 
         ups = Upstream(c, pc, lp)
         yield u, ups
@@ -277,7 +284,7 @@ def api_instance(upstream_n_distgit):
 
     pc = get_local_package_config(str(u))
     pc.upstream_project_url = str(u)
-    up_lp = LocalProject(path_or_url=str(u))
+    up_lp = LocalProject(working_dir=str(u))
 
     api = PackitAPI(c, pc, up_lp)
     yield u, d, api
@@ -292,7 +299,7 @@ def api_instance_source_git(sourcegit_n_distgit):
         pc = get_local_package_config(str(sourcegit))
         pc.upstream_project_url = str(sourcegit)
         pc.downstream_project_url = str(distgit)
-        up_lp = LocalProject(path_or_url=str(sourcegit))
+        up_lp = LocalProject(working_dir=str(sourcegit))
         api = PackitAPI(c, pc, up_lp)
         return api
 
diff --git a/tests/integration/test_build.py b/tests/integration/test_build.py
index ec12fd17..01dc4ac4 100644
--- a/tests/integration/test_build.py
+++ b/tests/integration/test_build.py
@@ -36,7 +36,7 @@ def test_basic_build(upstream_n_distgit, mock_remote_functionality_upstream):
         pc = get_local_package_config(str(u))
         pc.upstream_project_url = str(u)
         pc.downstream_project_url = str(d)
-        up_lp = LocalProject(path_or_url=u)
+        up_lp = LocalProject(working_dir=u)
 
         api = PackitAPI(c, pc, up_lp)
         api.build("master")
diff --git a/tests/integration/test_create_update.py b/tests/integration/test_create_update.py
index c7920a35..b9add1f0 100644
--- a/tests/integration/test_create_update.py
+++ b/tests/integration/test_create_update.py
@@ -299,7 +299,7 @@ def test_basic_bodhi_update(
         pc = get_local_package_config(str(u))
         pc.upstream_project_url = str(u)
         pc.downstream_project_url = str(d)
-        up_lp = LocalProject(path_or_url=u)
+        up_lp = LocalProject(working_dir=u)
 
         api = PackitAPI(c, pc, up_lp)
 
diff --git a/tests/integration/test_update.py b/tests/integration/test_update.py
index fa3b76a2..b0034fbb 100644
--- a/tests/integration/test_update.py
+++ b/tests/integration/test_update.py
@@ -65,7 +65,7 @@ def test_basic_local_update(upstream_n_distgit, mock_remote_functionality_upstre
         pc = get_local_package_config(str(u))
         pc.upstream_project_url = str(u)
         pc.downstream_project_url = str(d)
-        up_lp = LocalProject(path_or_url=str(u))
+        up_lp = LocalProject(working_dir=str(u))
         api = PackitAPI(c, pc, up_lp)
         api.sync_release("master", "0.1.0")
 
@@ -91,7 +91,7 @@ def test_basic_local_update_direct_push(
         pc = get_local_package_config(str(upstream))
         pc.upstream_project_url = str(upstream)
         pc.downstream_project_url = str(distgit)
-        up_lp = LocalProject(path_or_url=str(upstream))
+        up_lp = LocalProject(working_dir=str(upstream))
         api = PackitAPI(c, pc, up_lp)
         api.sync_release("master", "0.1.0", create_pr=False)
 
@@ -117,7 +117,7 @@ def test_basic_local_update_from_downstream(
         pc = get_local_package_config(str(u))
         pc.upstream_project_url = str(u)
         pc.downstream_project_url = str(d)
-        up_lp = LocalProject(path_or_url=str(u))
+        up_lp = LocalProject(working_dir=str(u))
         api = PackitAPI(c, pc, up_lp)
         api.sync_from_downstream("master", "master", True)
 
diff --git a/tests/integration/test_upstream.py b/tests/integration/test_upstream.py
index 80e6b0e1..66e7450d 100644
--- a/tests/integration/test_upstream.py
+++ b/tests/integration/test_upstream.py
@@ -102,9 +102,9 @@ def test_set_spec_ver(upstream_instance):
 
 
 def change_source0_ext(upstream, extension):
-    preamble = upstream.specfile.spec_content.section('%package')
+    preamble = upstream.specfile.spec_content.section("%package")
     for i, line in enumerate(preamble):
-        if line.startswith('Source0'):
+        if line.startswith("Source0"):
             source = line.split()[1]
             start = line.index(source)
             source = source.rstrip("".join(Path(source).suffixes)) + extension
@@ -112,13 +112,9 @@ def change_source0_ext(upstream, extension):
     upstream.specfile.save()
 
 
-@pytest.mark.parametrize('extension', [
-    '.tar.gz',
-    '.tar.bz2',
-], ids=[
-    '.tar.gz',
-    '.tar.bz2'
-])
+@pytest.mark.parametrize(
+    "extension", [".tar.gz", ".tar.bz2"], ids=[".tar.gz", ".tar.bz2"]
+)
 def test_create_archive(upstream_instance, extension):
     u, ups = upstream_instance
     change_source0_ext(ups, extension)
@@ -138,7 +134,7 @@ def test_create_archive(upstream_instance, extension):
 
 def test_create_uncommon_archive(upstream_instance):
     u, ups = upstream_instance
-    change_source0_ext(ups, '.cpio')
+    change_source0_ext(ups, ".cpio")
 
     with pytest.raises(PackitException):
         ups.create_archive()
diff --git a/tests/unit/test_local_project.py b/tests/unit/test_local_project.py
index e4b1780b..85317768 100644
--- a/tests/unit/test_local_project.py
+++ b/tests/unit/test_local_project.py
@@ -21,7 +21,6 @@
 # SOFTWARE.
 
 import tempfile
-from os import path
 
 import git
 from flexmock import flexmock
@@ -267,11 +266,8 @@ def test_clone_project_checkout_new_branch():
 # USAGE FROM CODE
 
 
-def test_from_git_url_path_or_url_repo_name_git_service():
-    flexmock(path).should_receive("isdir").with_args(
-        "./local/directory/to/git"
-    ).and_return(True).once()
-
+def test_working_dir_namespace_repo_name():
+    url = "https://server.git/my_namespace/package_name"
     flexmock(local_project).should_receive("is_git_repo").with_args(
         "./local/directory/to/git"
     ).and_return(True)
@@ -285,30 +281,26 @@ def test_from_git_url_path_or_url_repo_name_git_service():
     )
 
     project = LocalProject(
-        git_url="https://server.git/my_namespace/package_name",
+        working_dir="./local/directory/to/git",
         namespace="my_namespace",
         repo_name="package_name",
-        path_or_url="./local/directory/to/git",
         git_service=flexmock()
         .should_receive("get_project")
-        .and_return(flexmock())
+        .and_return(flexmock(get_git_urls=lambda: {"git": url}))
         .mock(),
     )
 
     assert project
-    assert project.git_url == "https://server.git/my_namespace/package_name"
+    assert project.git_url == url
     assert project.namespace == "my_namespace"
     assert project.repo_name == "package_name"
-    assert project.working_dir == "./local/directory/to/git"
     assert project.git_service
     assert project.git_project
     assert project.git_repo
     assert project.ref == "branch"
 
 
-def test_from_path_or_ulr_repo_name_git_service():
-    flexmock(path).should_receive("isdir").and_return(False).once()
-
+def test_from_path_repo_name_git_service():
     flexmock(git.Repo).should_receive("clone_from").and_return(
         flexmock(
             active_branch=flexmock(name="branch"),
@@ -320,7 +312,7 @@ def test_from_path_or_ulr_repo_name_git_service():
     flexmock(tempfile).should_receive("mkdtemp").and_return("some/temp/dir")
 
     project = LocalProject(
-        path_or_url="https://server.git/my_namespace/package_name",
+        git_url="https://server.git/my_namespace/package_name",
         repo_name="package_name",
         git_service=flexmock()
         .should_receive("get_project")
@@ -339,11 +331,7 @@ def test_from_path_or_ulr_repo_name_git_service():
     assert project.ref == "branch"
 
 
-def test_from_path_or_url_ref_path():
-    flexmock(path).should_receive("isdir").with_args(
-        "./local/directory/to/git"
-    ).and_return(True).once()
-
+def test_working_dir():
     flexmock(local_project).should_receive("is_git_repo").with_args(
         "./local/directory/to/git"
     ).and_return(True)
@@ -365,7 +353,7 @@ def test_from_path_or_url_ref_path():
         .mock()
     )
 
-    project = LocalProject(path_or_url="./local/directory/to/git")
+    project = LocalProject(working_dir="./local/directory/to/git")
 
     assert project
     assert project.git_url == "https://server.git/my_namespace/package_name"
@@ -438,79 +426,3 @@ def test_offline_no_clone_no_temp_dir():
     assert project.git_url == "http://some.example/url/reponame"
     assert not project.git_repo
     assert not project.working_dir
-
-
-# OVERWRITE
-
-
-def test_path_or_url_path():
-    """isdir=True"""
-    flexmock(path).should_receive("isdir").and_return(True).once()
-    project = LocalProject(
-        path_or_url="https://some/example/path",
-        git_repo=flexmock(branches={"other": flexmock(checkout=lambda: None)}),
-        git_url="https://nothing/else/matters",
-        ref="other",
-    )
-
-    assert project.working_dir == "https://some/example/path"
-    assert project.git_repo
-    assert project.git_url == "https://nothing/else/matters"
-
-
-def test_path_or_url_overwrite():
-    """overwrite the path_or_url with working_dir"""
-    flexmock(path).should_receive("isdir").and_return(True).once()
-    project = LocalProject(
-        path_or_url="https://some/example/path",
-        working_dir="new/dir",
-        git_repo=flexmock(branches={"other": flexmock(checkout=lambda: None)}),
-        git_url="https://nothing/else/matters",
-        ref="other",
-    )
-
-    assert project.working_dir == "new/dir"
-    assert project.git_repo
-    assert project.git_url == "https://nothing/else/matters"
-
-
-def test_path_or_url_url():
-    """isdir=False"""
-    flexmock(path).should_receive("isdir").and_return(False).once()
-
-    project = LocalProject(
-        path_or_url="http://some.example/url/reponame",
-        git_repo=flexmock(branches={"other": flexmock(checkout=lambda: None)}),
-        working_dir="nothing",
-        ref="other",
-    )
-
-    assert project.git_url == "http://some.example/url/reponame"
-    assert project.git_repo
-    assert project.working_dir == "nothing"
-
-
-def test_path_or_url_url_overwrite():
-    """overwrite the path_or_url with git_url"""
-    flexmock(path).should_receive("isdir").and_return(False).once()
-
-    project = LocalProject(
-        path_or_url="http://some.example/url/reponame",
-        git_repo=flexmock(branches={"other": flexmock(checkout=lambda: None)}),
-        working_dir="nothing",
-        git_url="http://some.new/url/reponame",
-        ref="other",
-    )
-
-    assert project.git_url == "http://some.new/url/reponame"
-    assert project.git_repo
-    assert project.working_dir == "nothing"
-
-
-def test_is_url():
-    project = LocalProject()
-    project.path_or_url = "https://github.com/packit-service/packit"
-    assert project._is_url(project.path_or_url)
-
-    project.path_or_url = "git@github.com:packit-service/ogr"
-    assert project._is_url(project.path_or_url)
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index 0856b50a..b2fd8e61 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -23,7 +23,7 @@
 import pytest
 from packit.exceptions import PackitException
 
-from packit.utils import get_namespace_and_repo_name
+from packit.utils import get_namespace_and_repo_name, is_str_url
 
 
 @pytest.mark.parametrize(
@@ -45,3 +45,17 @@ def test_get_ns_repo_exc():
         get_namespace_and_repo_name(url)
     msg = f"Invalid URL format, can't obtain namespace and repository name: {url}"
     assert msg in str(ex.value)
+
+
+@pytest.mark.parametrize(
+    "inp,ok",
+    [
+        ("/", False),
+        (None, False),
+        ("https://github.com/packit-service/packit", True),
+        ("git@github.com:packit-service/ogr", True),
+        ("ssh://ttomecek@pkgs.fedoraproject.org/rpms/alot.git", True),
+    ],
+)
+def test_is_str_url(inp, ok):
+    assert is_str_url(inp) == ok