Beispiel #1
0
 def post_account(client_id):
     try:
         account = Account.json_parse(request.json)
         AccountService.create_account(account, client_id)
         return jsonify(account.json()), 201
     except ResourceNotFound as r:
         return r.message, 404
    def create_user_withid(user_id):

        try:
            user_acct = UserService.get_user(int(user_id)).__dict__
            first_index = (list(user_acct.values())[0])
            print(first_index)
            # print("--------------testing-------------------")
            print(f" The value passed in is : {first_index}")
            for users in AccountService.all_account():
                # print(users)
                print()
                if list(users.values())[0] == first_index:
                    acc = Account()
                    acc.userid = first_index
                    # print(acc)
                    account = AccountService.create_account(acc)
                    # print(users)
                    return jsonify(account.json()), 201
                else:
                    print("Nothing found")

        except ResourceNotFound as r:
            return r.message, 404
 def test_00_create(self):
     self.assertTrue(
         AccountService.create_account(AccountServiceTest.account, 1))
Beispiel #4
0
 def post_account(cl_id):
     account = Account.json_parse_account(request.json)
     account.cl_id = int(cl_id)
     account = AccountService.create_account(account)
     return jsonify(account.json()), 201
Beispiel #5
0
 def add_account(client_id):
     account = Account.deserialize(request.json)
     return AccountService.create_account(account, client_id)
Beispiel #6
0
 def post_account():
     # account = Account.json_parse(request.json())
     account = Account.json_parse(request.json)
     AccountService.create_account(account)
     return jsonify(account.json())