import unittest
import django.test
import requests
from ..github_utils import (get_api_repo_branch_url,
                            get_repo_and_branch_from_repo_path,
                            get_main_branch_url)

class GithubUtilsTestCase(django.test.TestCase):
    def test_get_api_repo_branch_url(self):
        github_login = "RobrechtDR"
        repo = "asiakas"
        branch = "master"
        repo_url = get_api_repo_branch_url(github_login, repo, branch)
        self.assertEqual(repo_url, "https://api.github.com/repos/RobrechtDR/asiakas/branches/master")

    def test_get_repo_and_branch_from_repo_path_1(self):
        repo_and_branch_from_path = get_repo_and_branch_from_repo_path("asiakas/master")
        self.assertEqual(repo_and_branch_from_path, ("asiakas", "master"))

    def test_get_repo_and_branch_from_repo_path_2(self):
        repo_and_branch_from_path = get_repo_and_branch_from_repo_path("asiakas")
        self.assertEqual(repo_and_branch_from_path, ("asiakas", "master"))

    def test_get_repo_and_branch_from_repo_path_3(self):
        repo_and_branch_from_path = get_repo_and_branch_from_repo_path("asiakas/feature/registration")
        self.assertEqual(repo_and_branch_from_path, ("asiakas", "feature/registration"))

    def test_get_main_branch_url(self):
        target_url = "https://github.com/RobrechtDR/asiakas/tree/master"
        self.assertEqual(get_main_branch_url("RobrechtDR", "asiakas", "master"),
                         target_url)
        # Makes ~0.5 sec diff in tests
        #self.assertEqual(requests.get(target_url).status_code, 200)

@@ -208,17 +208,73 @@
 anch_url
-)
+,%0A                            get_last_commit_on_branch)%0A
 %0A%0Aclass 
@@ -1647,8 +1647,435 @@
 e, 200)%0A
+%0A    def test_get_last_commit_on_branch(self):%0A        # Project is moved so there are likely no new commits%0A        # TODO: Replace with my own test github project later%0A        github_login = %22dnerdy%22%0A        repo_name = %22factory_boy%22%0A        branch_name = %22master%22%0A        self.assertEqual(get_last_commit_on_branch(github_login, repo_name, branch_name),%0A                         '638704c06e7f3bc6412f2c81fe5b3073b397a60b')%0A

Make test for get_last_commit_on_branch