test: check latest github release
This commit is contained in:
parent
52f6c24982
commit
b5c48255e1
1 changed files with 40 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ from frappe.utils import (
|
|||
validate_phone_number_with_country_code,
|
||||
validate_url,
|
||||
)
|
||||
from frappe.utils.change_log import check_release_on_github, get_remote_url, parse_github_url
|
||||
from frappe.utils.data import (
|
||||
add_to_date,
|
||||
add_years,
|
||||
|
|
@ -1233,3 +1234,42 @@ class TestTypingValidations(FrappeTestCase):
|
|||
self.assertEqual(test_doctypes(doctype.as_dict()), doctype.as_dict())
|
||||
with self.assertRaises(FrappeTypeError):
|
||||
test_doctypes("a")
|
||||
|
||||
|
||||
class TestChangeLog(FrappeTestCase):
|
||||
def test_check_release_on_github(self):
|
||||
from semantic_version import Version
|
||||
|
||||
version, owner = check_release_on_github("frappe", "frappe")
|
||||
|
||||
self.assertIsInstance(version, Version)
|
||||
self.assertEqual(owner, "frappe")
|
||||
|
||||
self.assertRaises(ValueError, check_release_on_github, owner=None, repo=None)
|
||||
self.assertRaises(ValueError, check_release_on_github, owner=None, repo="frappe")
|
||||
self.assertRaises(ValueError, check_release_on_github, owner="frappe", repo=None)
|
||||
|
||||
def test_get_remote_url(self):
|
||||
self.assertIsInstance(get_remote_url("frappe"), str)
|
||||
self.assertRaises(ValueError, get_remote_url, app=None)
|
||||
self.assertRaises(ValueError, get_remote_url, app="this_doesnt_exist")
|
||||
|
||||
def test_parse_github_url(self):
|
||||
# using erpnext as repo in order to be different from the owner
|
||||
owner, repo = parse_github_url("https://github.com/frappe/erpnext.git")
|
||||
self.assertEqual(owner, "frappe")
|
||||
self.assertEqual(repo, "erpnext")
|
||||
|
||||
owner, repo = parse_github_url("https://github.com/frappe/erpnext")
|
||||
self.assertEqual(owner, "frappe")
|
||||
self.assertEqual(repo, "erpnext")
|
||||
|
||||
owner, repo = parse_github_url("git@github.com:frappe/erpnext.git")
|
||||
self.assertEqual(owner, "frappe")
|
||||
self.assertEqual(repo, "erpnext")
|
||||
|
||||
owner, repo = parse_github_url("https://gitlab.com/gitlab-org/gitlab")
|
||||
self.assertIsNone(owner)
|
||||
self.assertIsNone(repo)
|
||||
|
||||
self.assertRaises(ValueError, parse_github_url, remote_url=None)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue