Implemented url_in, url_is and corresponding tests

Change-Id: I11f8b97715add1590e0d80a7865a1f3511a04750
diff --git a/rsync_url.py b/rsync_url.py
index 49b6a32..968a627 100644
--- a/rsync_url.py
+++ b/rsync_url.py
@@ -1,6 +1,8 @@
 #-*- coding: utf-8 -*-
 
+import os
 import re
+
 import utils
 
 
@@ -150,6 +152,28 @@
                 return False
         return True
 
+    def _url_join(self, *suburls):
+        url = self.url
+        if len(url) > 1:
+            while url.endswith(os.path.sep):
+                url = url[:-1]
+
+        subs = os.path.sep.join(suburls).split(os.path.sep)
+        subs = [_ for _ in subs if _]
+
+        result = re.sub(r'^//', r'/', os.path.sep.join([url, ] + subs))
+        result = re.sub(r'([^:])//', r'\1/', result)
+        return result
+
     @property
     def url(self):
         return self._url
+
+    def url_in(self, *path):
+        result = self._url_join(*path)
+        if not result.endswith('/'):
+            result += '/'
+        return result
+
+    def url_is(self, *path):
+        return self._url_join(*path)