<commit_before>#!/usr/bin/env python

'''
'''

import unittest

from testRoot import RootClass

from noink.user_db import UserDB
from noink.activity_table import get_activity_dict

class AssignRole(RootClass):

    def test_AssignRole(self):
        user_db = UserDB()
        u = user_db.add("jontest", "pass", "<PASSWORD>")
        g = user_db.add_group('test_group')
        gid = g.id
        user_db.add_to_group(u, g)
        groups = set(user_db.get_users_groups(u))
        self.assertTrue(g in groups)

if __name__ == '__main__':
    unittest.main()
<commit_msg>finish assign role<commit_after>#!/usr/bin/env python

'''
'''

import unittest

from testRoot import RootClass

from noink.user_db import UserDB
from noink.role_db import RoleDB
from noink.activity_table import get_activity_dict

class AssignRole(RootClass):

    def test_AssignRole(self):
        user_db = UserDB()
        role_db = RoleDB()
        u = user_db.add("jontest", "pass", "<PASSWORD>")
        g = user_db.add_group('test_group')
        user_db.add_to_group(u, g)
        r = role_db.add_role('test_role', 'test role', get_activity_dict(True))
        role_db.assign_role(u, g, r)
        all_roles = set(rm.role for rm in role_db.get_roles(u))
        self.assertTrue(r in all_roles)

if __name__ == '__main__':
    unittest.main()

{'fraction_non_alphanumeric': 0.11800302571860817, 'fraction_numerical': 0.0, 'mean_word_length': 3.366336633663366, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6618794', 'n_tokens_mistral': 470, 'n_tokens_neox': 468, 'n_words': 100}