~ubuntu-branches/ubuntu/saucy/autopilot/saucy-proposed

« back to all changes in this revision

Viewing changes to autopilot/tests/functional/test_application_mixin.py

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2013-06-07 13:33:46 UTC
  • mfrom: (57.1.1 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130607133346-42zvbl1h2k1v54ac
Tags: 1.3daily13.06.05-0ubuntu2
autopilot-touch only suggests python-ubuntu-platform-api for now.
It's not in distro and we need that requirement to be fulfilled to
have unity 7, 100 scopes and the touch stack to distro.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 
2
#
 
3
# Autopilot Functional Test Tool
 
4
# Copyright (C) 2012-2013 Canonical
 
5
#
 
6
# This program is free software: you can redistribute it and/or modify
 
7
# it under the terms of the GNU General Public License as published by
 
8
# the Free Software Foundation, either version 3 of the License, or
 
9
# (at your option) any later version.
 
10
#
 
11
# This program is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
#
 
19
 
 
20
 
 
21
from __future__ import absolute_import
 
22
 
 
23
from autopilot.testcase import AutopilotTestCase
 
24
from testtools.matchers import raises
 
25
 
 
26
 
 
27
class ApplicationSupportTests(AutopilotTestCase):
 
28
 
 
29
    def test_launch_with_bad_types_raises_typeerror(self):
 
30
        """Calling launch_test_application with something other than a string must
 
31
        raise a TypeError"""
 
32
 
 
33
        self.assertThat(lambda: self.launch_test_application(1), raises(TypeError))
 
34
        self.assertThat(lambda: self.launch_test_application(True), raises(TypeError))
 
35
        self.assertThat(lambda: self.launch_test_application(1.0), raises(TypeError))
 
36
        self.assertThat(lambda: self.launch_test_application(object()), raises(TypeError))
 
37
        self.assertThat(lambda: self.launch_test_application(None), raises(TypeError))
 
38
        self.assertThat(lambda: self.launch_test_application([]), raises(TypeError))
 
39
        self.assertThat(lambda: self.launch_test_application((None,)), raises(TypeError))
 
40
 
 
41
    def test_launch_raises_ValueError_on_unknown_kwargs(self):
 
42
        """launch_test_application must raise ValueError when given unknown
 
43
        keyword arguments.
 
44
 
 
45
        """
 
46
        fn = lambda: self.launch_test_application('gedit', arg1=123, arg2='asd')
 
47
        self.assertThat(fn, raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
 
48
 
 
49
    def test_launch_raises_ValueError_on_unknown_kwargs_with_known(self):
 
50
        """launch_test_application must raise ValueError when given unknown
 
51
        keyword arguments.
 
52
 
 
53
        """
 
54
        fn = lambda: self.launch_test_application('gedit', arg1=123, arg2='asd', launch_dir='/')
 
55
        self.assertThat(fn, raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))