import os
import subprocess
from unittest import TestCase


class TestAssetsCoreOS(TestCase):
    func_path = "%s" % os.path.dirname(__file__)
    tests_path = "%s" % os.path.split(func_path)[0]
    app_path = os.path.split(tests_path)[0]
    project_path = os.path.split(app_path)[0]
    assets_path = "%s/bootcfg/assets" % project_path
    asset_test = "%s/coreos" % assets_path
    default_files = ["Makefile"]

    def test_00_fclean(self):
        expect = self.default_files
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test, "fclean"])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

    def test_01_default(self):
        expect = self.default_files + ["1192.1.0"]
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

    def test_02_serve(self):
        expect = self.default_files + ["1192.1.0", "serve"]
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test, "serve"])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

    def test_03_clean(self):
        expect = self.default_files + ["serve"]
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test, "clean"])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

    def test_04_fclean(self):
        subprocess.check_output(["make", "-C", self.asset_test, "fclean"])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(self.default_files, real)


class TestAssetsSetupNetworkEnvironment(TestCase):
    func_path = "%s" % os.path.dirname(__file__)
    tests_path = os.path.split(func_path)[0]
    app_path = os.path.split(tests_path)[0]
    project_path = os.path.split(app_path)[0]
    print "project_path ==", project_path
    assets_path = "%s/bootcfg/assets" % project_path
    asset_test = "%s/setup-network-environment" % assets_path
    default_files = ["Makefile", "1.0.1-setup-network-environment.sha512"]

    def test_00_fclean(self):
        expect = self.default_files
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test, "fclean"])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

    def test_01_default(self):
        expect = self.default_files + ["1.0.1"]
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

    def test_02_serve(self):
        expect = self.default_files + ["1.0.1", "serve"]
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test, "serve"])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

    def test_03_clean(self):
        expect = self.default_files + ["serve"]
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test, "clean"])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

    def test_04_fclean(self):
        expect = self.default_files
        expect.sort()
        subprocess.check_output(["make", "-C", self.asset_test, "fclean"])
        real = os.listdir(self.asset_test)
        real.sort()
        self.assertEqual(expect, real)

@@ -1970,50 +1970,8 @@
 %5B0%5D%0A
-    print %22project_path ==%22, project_path%0A
     

Remove useless print