예제 #1
0
def update_members(group_id, file_path, act_as=None):
    try:
        use_django_backend()
    except ImportError:
        settings = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                'settings.cfg')
        use_configparser_backend(settings, 'GWS')

    members = []
    with open(file_path, 'r') as f:
        for line in f:
            members.append(
                GroupEntity(name=line.strip(), type=GroupEntity.UWNETID_TYPE))

    client = GWS(act_as=act_as, log_errors=True)
    errors = client.update_members(group_id, members)

    if len(errors):
        print(errors)
예제 #2
0
def guess_backend():
    from django.conf import settings
    from commonconf.backends import use_django_backend
    use_django_backend()
예제 #3
0
 def test_invalid(self):
     use_django_backend()
     with self.assertRaises(Exception):
         settings.MISSING_KEY_FOR_TESTING
예제 #4
0
    def test_default_value(self):
        use_django_backend()

        value = getattr(settings, "MISSING_KEY_FOR_TESTING", "OK")
        self.assertEquals(value, "OK")
예제 #5
0
    def test_valid(self):
        use_django_backend()

        value = settings.DEBUG