def test_get_account_list(self):
"""It should Get a list of Accounts"""
self._create_accounts(5)
resp = self.client.get(BASE_URL)
self.assertEqual(resp.status_code, status.HTTP_200_OK)
data = resp.get_json()
self.assertEqual(len(data), 5)
######################################################################
# LIST ALL ACCOUNTS
######################################################################
@app.route("/accounts", methods=["GET"])
def list_accounts():
"""
List all Accounts
This endpoint will list all Accounts
"""
app.logger.info("Request to list Accounts")
accounts = Account.all()
account_list = [account.serialize() for account in accounts]
app.logger.info("Returning [%s] accounts", len(account_list))
return jsonify(account_list), status.HTTP_200_OK
def test_update_account(self):
"""It should Update an existing Account"""
# create an Account to update
test_account = AccountFactory()
resp = self.client.post(BASE_URL, json=test_account.serialize())
self.assertEqual(resp.status_code, status.HTTP_201_CREATED)
# update the account
new_account = resp.get_json()
new_account["name"] = "Something Known"
resp = self.client.put(f"{BASE_URL}/{new_account['id']}", json=new_account)
self.assertEqual(resp.status_code, status.HTTP_200_OK)
updated_account = resp.get_json()
self.assertEqual(updated_account["name"], "Something Known")
######################################################################
# UPDATE AN EXISTING ACCOUNT
######################################################################
@app.route("/accounts/<int:account_id>", methods=["PUT"])
def update_accounts(account_id):
"""
Update an Account
This endpoint will update an Account based on the posted data
"""
app.logger.info("Request to update an Account with id: %s", account_id)
account = Account.find(account_id)
if not account:
abort(status.HTTP_404_NOT_FOUND, f"Account with id [{account_id}] could not be found.")
account.deserialize(request.get_json())
account.update()
return account.serialize(), status.HTTP_200_OK
def test_delete_account(self):
"""It should Delete an Account"""
account = self._create_accounts(1)[0]
resp = self.client.delete(f"{BASE_URL}/{account.id}")
self.assertEqual(resp.status_code, status.HTTP_204_NO_CONTENT)
######################################################################
# DELETE AN ACCOUNT
######################################################################
@app.route("/accounts/<int:account_id>", methods=["DELETE"])
def delete_accounts(account_id):
"""
Delete an Account
This endpoint will delete an Account based on the account_id that is requested
"""
app.logger.info("Request to delete an Account with id: %s", account_id)
account = Account.find(account_id)
if account:
account.delete()
return "", status.HTTP_204_NO_CONTENT
def test_method_not_allowed(self):
"""It should not allow an illegal method call"""
resp = self.client.delete(BASE_URL)
self.assertEqual(resp.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
next-project's Introduction
next-project's People
next-project's Issues
build
Building image for $(params.repo-url)
deploy
Deploying
CD Pipeline
Given the CD pipeline has been created
When I trigger the pipeline run
Then I should see the accounts service deployed to OpenShift
Assumptions
Use Tekton to define the pipeline
It should clone, lint, test, build, and deploy the service
Deployment should be to OpenShift
It can use a manual trigger for this MVP
Need to Add Security Headers and CORS Policies
Read an account from the service
Containerize your microservice using Docker
Need the Ability to Automate Continuous Integration Checks
Title: Need the ability to automate continuous integration checks
As a Developer
I need automation to build and test every pull request
So that I do not have to rely on manual testing of each request, which is time-consuming
#### Assumptions
* GitHub Actions will be used for the automation workflow
* The workflow must include code linting and testing
* The Docker image should be postgres:alpine for the database
* A GitHub Actions badge should be added to the README.md to reflect the build status
#### Acceptance Criteria
```gherkin
Given code is ready to be merged
When a pull request is created
Then GitHub Actions should run linting and unit tests
And the badge should show that the build is passing
Delete an account from the service
Update an account in the service
.github/ISSUE_TEMPLATES
Deploy your Docker image to Kubernetes
List all accounts in the service
tests
Running unit tests with PyUnit
Set up the development environment
clone
Cloning the repo $(params.repo-url)
lint
Calling Flake8 linter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.