Skip to content

Commit

Permalink
feat(name): oauth22 -> oauth2_v2
Browse files Browse the repository at this point in the history
Related to #3
  • Loading branch information
Byron committed Mar 12, 2015
1 parent 97b2649 commit 664d822
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/mako/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,13 @@ def to_api_version(v):

# build a full library name (non-canonical)
def library_name(name, version):
return name + to_api_version(version)
version = to_api_version(version)
assert not version.startswith('v')

if name[-1].isdigit():
name += '_'
version = 'v' + version
return name + version

# return type name of a resource method builder, from a resource name
def rb_type(r):
Expand Down Expand Up @@ -831,4 +837,11 @@ def test_to_version():
AssertionError("Call should have failed")
# end for each invalid version
# suite

def test_library_name():
for v, want in (('v1', 'oauth2_v1'),
('v1.4', 'oauth2_v1d4'),):
res = library_name('oauth2', v)
assert res == want, "%s ~== %s" % (res, want)
test_to_version()
test_library_name()

0 comments on commit 664d822

Please sign in to comment.