Skip to content

Commit

Permalink
Add user for UT.
Browse files Browse the repository at this point in the history
  • Loading branch information
ganglyu committed Jun 17, 2022
1 parent 25c057d commit 46ae5b1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/test_gnmi_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def test_gnmi_set_with_jwt_neg(self):
assert 'Unauthenticated' in msg

def test_gnmi_set_with_jwt(self):
ret, msg = gnoi_authenticate('gnmitest', 'wrongpass')
username = 'gnmitest1'
password = 'password1'
run_cmd('sudo useradd -p %s %s'%(password, username))
ret, msg = gnoi_authenticate(username, password)
assert ret == 0, msg
assert 'access_token' in msg
searchObj = re.search( r'"access_token":"(.*?)"', msg, re.M|re.I)
Expand All @@ -70,7 +73,10 @@ def test_gnmi_set_with_jwt(self):
class TestGNOIAuth:

def test_gnoi_authenticate(self):
ret, msg = gnoi_authenticate('gnmitest', 'wrongpass')
username = 'gnmitest2'
password = 'password2'
run_cmd('sudo useradd -p %s %s'%(password, username))
ret, msg = gnoi_authenticate(username, password)
assert ret == 0, msg
assert 'access_token' in msg
searchObj = re.search( r'"access_token":"(.*?)"', msg, re.M|re.I)
Expand Down

0 comments on commit 46ae5b1

Please sign in to comment.