Allow RefineProject to take just a project id as a convenience.
This commit is contained in:
parent
f3354f6fc1
commit
45a80902ef
|
@ -222,6 +222,10 @@ class RefineProject:
|
|||
if '/project?project=' in server:
|
||||
server, project_id = server.split('/project?project=')
|
||||
server = RefineServer(server)
|
||||
elif re.match(r'\d+$', server): # just digits => project ID
|
||||
server, project_id = RefineServer(), server
|
||||
else:
|
||||
server = RefineServer(server)
|
||||
self.server = server
|
||||
if not project_id:
|
||||
raise Exception('Missing Refine project ID')
|
||||
|
|
|
@ -63,6 +63,9 @@ class RefineProjectTest(unittest.TestCase):
|
|||
p = RP('http://server/varnish/project?project=1658955153749')
|
||||
self.assertEqual(p.server.server, 'http://server/varnish')
|
||||
self.assertEqual(p.project_id, '1658955153749')
|
||||
p = RP('1658955153749')
|
||||
self.assertEqual(p.server.server, 'http://127.0.0.1:3333')
|
||||
self.assertEqual(p.project_id, '1658955153749')
|
||||
|
||||
def tearDown(self):
|
||||
# Restore mocked get_models
|
||||
|
|
Loading…
Reference in New Issue