1# 2# Copyright (C) 2018 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17import unittest 18 19from host_controller.campaigns import cts 20from host_controller.campaigns import gts 21from host_controller.campaigns import sts 22from host_controller.campaigns import vts 23 24from host_controller.campaigns.testdata import default_testcase 25 26 27class CampaignTest(unittest.TestCase): 28 """Unit tests for the campaign generators.""" 29 30 def setUp(self): 31 self.maxDiff = None 32 33 def testVtsBaseline(self): 34 """Tests the default device's vts scenario.""" 35 test_name = "vts/vts" 36 results = vts.EmitConsoleCommands( 37 **default_testcase.GenerateInputData(test_name)) 38 self.assertEqual( 39 default_testcase.GenerateOutputData(test_name), results) 40 41 def testCtsOnGsiBaseline(self): 42 """Tests the default device's vts scenario.""" 43 test_name = "vts/cts-on-gsi" 44 results = vts.EmitConsoleCommands( 45 **default_testcase.GenerateInputData(test_name)) 46 self.assertEqual( 47 default_testcase.GenerateOutputData(test_name), results) 48 49 def testCtsBaseline(self): 50 """Tests the default device's vts scenario.""" 51 test_name = "cts/cts" 52 results = cts.EmitConsoleCommands( 53 **default_testcase.GenerateInputData(test_name)) 54 self.assertEqual( 55 default_testcase.GenerateOutputData(test_name), results) 56 57 def testGtsBaseline(self): 58 """Tests the default device's vts scenario.""" 59 test_name = "gts/gts" 60 results = gts.EmitConsoleCommands( 61 **default_testcase.GenerateInputData(test_name)) 62 self.assertEqual( 63 default_testcase.GenerateOutputData(test_name), results) 64 65 def testStsBaseline(self): 66 """Tests the default device's vts scenario.""" 67 test_name = "sts/sts" 68 results = sts.EmitConsoleCommands( 69 **default_testcase.GenerateInputData(test_name)) 70 self.assertEqual( 71 default_testcase.GenerateOutputData(test_name), results) 72 73 74if __name__ == '__main__': 75 unittest.main() 76