Skip to content

Commit

Permalink
Merge pull request #537 from zimingd/SYNPY-706
Browse files Browse the repository at this point in the history
fixed attrubute error for syn.username when not logged in (SYNPY-706)
  • Loading branch information
kimyen authored May 7, 2018
2 parents e1f2576 + 4d539e5 commit 3f9e4df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion synapseclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def debug(self, value):

@property
def username(self): #for backwards compatability when username was a part of the Synapse object and not in credentials
return self.credentials.username
return self.credentials.username if self.credentials is not None else None


def getConfigFile(self, configPath):
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/unit_test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,9 @@ def test_input_is_SchemaBase(self):
schema = EntityViewSchema(parentId="syn123")
results = list(syn.getColumns(schema))
assert_equal(get_table_colums_results, results)
mock_get_table_coulmns.assert_called_with(schema)
mock_get_table_coulmns.assert_called_with(schema)

def test_username_property__credentials_is_None():
syn.credentials = None
assert_is_none(syn.username)

0 comments on commit 3f9e4df

Please sign in to comment.