def test_duplicate_user(self): with open(test_filepath, 'w') as f: content = ["user2 ", "user3\n", users[0][0]] f.writelines(content) self.assertFalse(GroupManager.create_groups(filepath=test_filepath))
def create_groups(group_count=0, users_per_group=0, filepath=None): return GroupManager.create_groups(group_count, users_per_group, filepath)
def test_nonexistent(self): self.assertFalse(GroupManager.create_groups(filepath="notafile.txt"))
def test_whitespace(self): with open(test_filepath, 'w') as f: f.write(" ") self.assertFalse(GroupManager.create_groups(filepath=test_filepath))
def update_user(username, updated_user): return GroupManager.update_user(username, updated_user)
def test_import(self): with open(test_filepath, 'w') as f: f.writelines(file_content) self.assertTrue(GroupManager.create_groups(filepath=test_filepath))
def test_change_id(self): self.assertFalse( GroupManager.update_group(start_id, Group(**updated_group)))
def attach_platform(group_id, platform_name): return GroupManager.attach_platform(group_id, platform_name)
def tearDown(self): GroupManager.delete_group(start_id)
def test_update_nonexistent(self): self.assertFalse(GroupManager.update_group(102, Group(**updated_group)))
def setUp(self): global start_id start_id = get_next_id() GroupManager.create_groups(1, 2)
def test_create_groups(self): global start_id start_id = get_next_id() self.assertTrue(GroupManager.create_groups(group_count, user_count))
def tearDown(self): for i in range(group_count): GroupManager.delete_group(start_id + i)
def update_group(group_id, updated_group): return GroupManager.update_group(group_id, updated_group)
def test_group_delete(self): self.assertTrue(GroupManager.delete_group(1000))
def delete_group(group_id): return GroupManager.delete_group(group_id)
def test_group_delete(self): GroupManager.delete_group(1000) self.assertIsNone(get_group(1000))
def detach_platform(platform_name): return GroupManager.detach_platform(platform_name)
def tearDown(self): GroupManager.delete_group(1000)
def delete_user(username): return GroupManager.delete_user(username)
def tearDown(self): for line in file_users(): current = get_user(line[0]).group_id GroupManager.delete_group(current)