-
Simple Testing
11 Lessons-
StartWhat we'll cover in this section
-
PreviewCreating a simple command line application
-
StartWriting a our first test for the isPrime() function
-
StartImproving our test with table tests
-
StartChecking test coverage
-
StartCompleting our table tests
-
StartImproving our program to allow for user entered information
-
StartWriting a test for the prompt() function
-
StartWriting a test for the intro() function
-
StartTesting user input - writing a test for the checkNumbers() function
-
StartUpdating readUserInput to make it testable, and then testing it
-
-
Testing Web Applications
11 Lessons-
StartWhat we'll cover in this section
-
PreviewCreating a simple web app
-
StartSetting up a route and handler for the home page
-
StartTesting our application routes
-
StartTesting Handlers: the Home handler
-
StartSetting up some simple middleware
-
StartTrying out our new addIPToContext middleware
-
StartTesting our middleware
-
StartTesting ipFromContext
-
StartCreating a login form
-
StartSetting up a route and stub handler for the login form
-
-
Testing Sessions
9 Lessons-
StartWhat we'll cover in this section
-
StartSetting up a test enviroment with testing.M
-
StartSimplifying our templates using a layout
-
StartInstalling a sessions package
-
StartAdding session to App config, and creating a SessionManager
-
StartTrying out our sessions
-
StartUpdating our tests
-
StartImproving our test for the Home handler
-
StartTesting the render function with a bad template
-
-
Testing POST Handlers
14 Lessons-
StartWhat we'll cover in this section
-
StartInstalling postgres with Docker
-
StartSetting up a database connection
-
StartAdding the data package for models and db package for database access
-
StartMaking sure our web app can connect to our database
-
StartClosing our database pool gracefully, and resetting template path in tests
-
StartCreating a stub profile page
-
StartAdding messages to our template data and template files
-
StartAdding true authentication to the Login handler
-
StartTesting the Login handler
-
StartAdding Auth middleware
-
StartTesting Auth middleware
-
StartUpdating routes & end-to-end tests
-
StartProblems with our Login handler test
-
-
The Repository Pattern
7 Lessons-
StartWhat we'll cover in this section
-
StartDefining an interface type for our repository
-
StartMoving our database functions into a repository
-
StartUpdating application config to use the database repository
-
StartCreating a testdb repository
-
StartUpdating setup_test.go to use the test repository
-
StartUpdating our tests to use the testdb repository
-
-
Testing the database with Integration tests
12 Lessons-
StartWhat we'll cover in this section
-
StartGetting started with testing our database
-
StartGetting our tests to spin up a docker image with Postgres
-
StartPopulating our test database with empty tables
-
StartTesting InsertUser
-
StartTesting AllUsers
-
StartTesting GetUser and GetUserByEmail
-
StartTesting UpdateUser
-
StartTesting DeleteUser
-
StartTesting ResetUserPassword
-
StartTesting InsertUserImage
-
StartUsing build tags to separate our integration tests
-
-
Testing File Uploads
9 Lessons-
StartWhat we'll cover in this section
-
StartAdding a form to the Profile page
-
StartAdding the UserImage type to the User type
-
StartUpdating the profile.page.gohtml file to look for a profile image
-
StartWriting a stub handler and a function to process profile image uploads
-
StartImplementing the UploadProfilePic handler
-
StartTrying things out
-
StartTesting image uploads
-
StartTesting our upload handler, with an alternative approach
-
-
Testing REST API's
21 Lessons-
StartWhat we'll cover in this section
-
StartSetting up an api with our existing code base
-
StartAdding stub handlers (endpoints) for our API
-
StartTrying out our REST API to make sure things work
-
StartGetting started with JWT Authentication
-
StartGenerating token pairs
-
StartImplementing the authenticate handler
-
StartTrying out the authentication handler
-
StartTesting our authentication handler
-
StartSetting up a simple program to generate tokens for testing
-
StartTesting generating and validating tokens
-
StartSetting up our application middleware
-
StartTesting our CORS middleware
-
StartTesting our authRequired middleware
-
StartAdd middleware to routes
-
StartTesting API routes
-
StartImplementing the handler to refresh tokens
-
StartTesting refreshing tokens
-
StartCompleting the handlers that interact with the User type
-
StartTesting the handlers that interact with the User type
-
StartFinishing up testing handlers that interact with the data.User type
-
-
Testing an API for Single Page Application (SPA)
10 Lessons-
StartWhat we'll cover in this section
-
StartServing HTML for our SPA
-
StartAuthenticating users with our SPA
-
StartSetting a refresh token cookie when authenticating
-
StartAllowing users to refresh tokens using a cookie
-
StartAutomatically refreshing tokens while the user is logged in
-
StartGetting a user from our simple SPA with the "Get User" button
-
StartLogging web users out
-
StartTesting refreshing tokens for Single Page Apps
-
StartTesting logging users out of our SPA
-
