def test_create_site_dir(): site_utils.create_site_dir("test") tdir = os.path.join(site.getuserbase(), "test") #print "tdir: %s" % str(tdir) assert os.path.exists(tdir) site_utils._remove_site_dir("test") assert not site_utils.site_dir_exists("test")
def compare_versions(site_dir, entry): site_path = os.path.join(site_utils.get_site_base(), site_dir) print "Create a site dir: %s" % site_dir site_utils.create_site_dir(site_dir) remote_version_path = "%s/%s" % (URL_BASE, VERSION_NAME) #print "%s" % remote_version_path remote_version_raw = get_remote_version(remote_version_path) remote_version = json.loads(remote_version_raw) if entry not in remote_version: raise RemoteDefinition("%s is not within the remote version" % entry) local_version_path = os.path.join(site_path, VERSION_NAME) local_version_raw = get_local_version(local_version_path) local_version = json.loads(local_version_raw) if entry not in local_version: raise LocalDefinition("%s is not within local version" % entry) if local_version[entry] != remote_version[entry]: print "Local != Remote: %s != %s" % (local_version[entry], remote_version[entry]) update_local_version(site_dir, entry, remote_version[entry]) else: print "local and remote are the same"