コード例 #1
0
    def post():
        json_data = request.get_json(force=True)
        if not json_data:
            return {'message': 'No input data provided'}, 400
        data, errors = user_create_request_schema.load(json_data)
        if errors:
            return errors, 422
        from AccountManager.account_manager import AccountManager

        if "filepath" in data:
            results = AccountManager.create_groups(data["group_count"],
                                                   data["users_per_group"],
                                                   data["filepath"])
        else:
            results = AccountManager.create_groups(data["group_count"],
                                                   data["users_per_group"])

        if results:
            return group_response_schema.dump({"success": results})
        else:
            return {"success": False}, 409
コード例 #2
0
 def setUp(self):
     global start_id
     start_id = get_next_id()
     AccountManager.create_groups(1, 2)
コード例 #3
0
 def test_create_groups(self):
     global start_id
     start_id = get_next_id()
     self.assertTrue(AccountManager.create_groups(group_count, user_count))
コード例 #4
0
 def test_import(self):
     with open(test_filepath, 'w') as f:
         f.writelines(file_content)
     self.assertTrue(AccountManager.create_groups(filepath=test_filepath))