Commit 0933247d authored by Ryan Herbert's avatar Ryan Herbert Committed by Mikaël Salson

SampleSetList update unit tests

parent fc95ea04
...@@ -19,37 +19,32 @@ class SamplesetlistModel(unittest.TestCase): ...@@ -19,37 +19,32 @@ class SamplesetlistModel(unittest.TestCase):
factory = ModelFactory() factory = ModelFactory()
helper = factory.get_instance(type='patient') helper = factory.get_instance(type='patient')
slist = SampleSetList(helper) slist = SampleSetList(helper)
self.assertTrue(len(slist.element_ids) > 0, "The sample set list was not expected to be empty") self.assertTrue(len(slist) > 0, "The sample set list was not expected to be empty")
def testCreatorNames(self): def testCreatorNames(self):
factory = ModelFactory() factory = ModelFactory()
helper = factory.get_instance(type='patient') helper = factory.get_instance(type='patient')
slist = SampleSetList(helper) slist = SampleSetList(helper)
slist.load_creator_names() values = slist.result
values = slist.get_values()
first = values[0] first = values[0]
name = first.creator name = helper.get_creator(first)
self.assertFalse(name == "", "load_creator_names failed to retrieve a username") self.assertFalse(name == "", "load_creator_names failed to retrieve a username")
def testPermittedGroups(self): def testPermittedGroups(self):
factory = ModelFactory() factory = ModelFactory()
helper = factory.get_instance(type='patient') helper = factory.get_instance(type='patient')
slist = SampleSetList(helper) slist = SampleSetList(helper)
slist.load_permitted_groups() value = slist.result[0]
value = slist.get_values()[0] groups = helper.get_groups(value)
groups = value.groups
group_list = value.group_list
self.assertFalse(groups == "", "load_permitted_groups didn't load ay groups") self.assertFalse(groups == "", "load_permitted_groups didn't load ay groups")
self.assertFalse(group_list == [], "load_permitted_groups found groups although the group_list is empty")
def testAnonPermissions(self): def testAnonPermissions(self):
factory = ModelFactory() factory = ModelFactory()
helper = factory.get_instance(type='patient') helper = factory.get_instance(type='patient')
slist = SampleSetList(helper) slist = SampleSetList(helper)
slist.load_anon_permissions() value = slist.result[0]
value = slist.get_values()[0]
self.assertFalse(value.anon_allowed, "Anon was allowed, when it was not expected to be") self.assertFalse(value.has_permission, "Anon was allowed, when it was not expected to be")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment