Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Honing my craft

Samkit Jain samkit-jain

👨‍💻
Honing my craft
View GitHub Profile
View template.md

Title

Status (Draft / Under Review / Approved / Deployed)
Targets (Backend / Frontend)
Author(s) Names of the people writing the RFC
Developer(s) Names of the people responsible for the implementation of the RFC
Reviewer(s) Names of the people verifying the RFC
Updated YYYY-MM-DD
@samkit-jain
samkit-jain / buildspec.yml
Created Sep 15, 2021
Buildspec with codecov
View buildspec.yml
version: 0.2
env:
variables:
ECR_REGISTRY: 1234567890.dkr.ecr.ap-southeast-1.amazonaws.com
ECR_REPOSITORY: repository
secrets-manager:
DOCKER_HUB_USERNAME: arn:aws:secretsmanager:ap-southeast-1:1234567890:secret:dockerhub:username
DOCKER_HUB_PASSWORD: arn:aws:secretsmanager:ap-southeast-1:123457890:secret:dockerhub:password
View buildspec.yml
version: 0.2
env:
variables:
ECR_REGISTRY: 1234567890.dkr.ecr.ap-southeast-1.amazonaws.com
ECR_REPOSITORY: repository
secrets-manager:
DOCKER_HUB_USERNAME: arn:aws:secretsmanager:ap-southeast-1:1234567890:secret:dockerhub:username
DOCKER_HUB_PASSWORD: arn:aws:secretsmanager:ap-southeast-1:123457890:secret:dockerhub:password
View test_01_signin_api.py
def test_sign_in_01(client):
# Sign in a user by testing the ``POST /signin/`` API endpoint.
# Uisng the same user as created in the ``test_sign_up_01()`` test.
response = client.post(
"/signin/",
json={"username": "username", "password": "password"},
)
assert response.status_code == 200
assert response.json == {"message": "Logged in"}
View test_00_signup_api.py
def test_sign_up_01(client):
# Sign up a user by testing the ``POST /signup/`` API endpoint.
response = client.post(
"/signup/",
json={"username": "username", "password": "password"},
)
assert response.status_code == 200
assert response.json == {"message": "Registration successful"}
# If you want to go an extra step, can also check if the entry was created
@samkit-jain
samkit-jain / conftest.py
Last active Sep 15, 2021
Juvoxa Testing
View conftest.py
import pytest
def pytest_sessionstart(session):
"""This is run before the tests are run.
So, if you want to make any changes like creating a dummy ``.env`` file,
you can do so here.
"""
pass
View create_zip.sh
#!/usr/bin/env bash
set -xe
# build binary
GOARCH=amd64 GOOS=linux go build -o bin/application application.go
# create zip containing the bin, assets and .ebextensions folder
zip -r uploadThis.zip bin public .ebextensions
View build.sh
#!/usr/bin/env bash
set -xe
# install packages and dependencies
go get github.com/dgrijalva/jwt-go
# build command
go build -o bin/application application.go