A New Start

Nicholas An
1 min readFeb 2, 2021

--

Since last Tuesday, I have started working at a new company: Tradir. Tradir is the company responsible for tradir.io, which is a collaboration web app for international trade. Leaving behind the previous project (brought to you by Hodosoft) was no easy process but the challenges at Tradir are much more burdensome. First of all, the codebase flaunts all sorts of advanced features of Python and Django. It’s been a week and I still have no idea how I am going to catch up with this. I need to create some sort of roadmap for just the onboarding process.

So far, I have crafted some unit tests. They take about 1 percent of the whole list of the Tradir application. Gotta start somewhere.

import pytest
import json

from django.urls import reverse
from django.contrib.auth.models import User
from django.test import Client
from mixer.backend.django import mixer

from user.models import SocialLoginPlatform
from contacts.models import Country


pytestmark = pytest.mark.django_db

client = Client()

@pytest.fixture()
def user():
user = mixer.blend(User, first_name="Nick", username="nickanism")
return user

@pytest.fixture()
def social_platform():
SocialLoginPlatform.objects.create(name="none")
social_platform = mixer.blend(SocialLoginPlatform, name="google")
return social_platform

@pytest.fixture()
def country():
country = mixer.blend(Country, name="South Korea", code="KR")
return country

@pytest.mark.django_db
def test_user_profile_check(user, social_platform, country):
assert user.first_name == "Nick"
assert social_platform.name == "google"
assert country.name == "South Korea"
assert user.profile != None

@pytest.mark.django_db
def test_user_creation_country_list(client, country):
url = reverse('country-list')
response = client.get(url)
assert response.status_code == 200
assert json.loads(response.content)['country_list'][0]['name'] == country.name

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Nicholas An
Nicholas An

Written by Nicholas An

Backend Server Developer in South Korea

No responses yet

Write a response