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

« back to all changes in this revision

Viewing changes to autopilot/tests/unit/test_backend.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 testtools import TestCase
 
22
from testtools.matchers import Equals, Not, NotEquals
 
23
from autopilot.introspection.backends import DBusAddress
 
24
 
 
25
class DBusAddressTests(TestCase):
 
26
 
 
27
    def test_can_construct(self):
 
28
        fake_bus = object()
 
29
        addr = DBusAddress(fake_bus, "conn", "path")
 
30
 
 
31
    def test_can_store_address_in_dictionary(self):
 
32
        fake_bus = object()
 
33
        addr = DBusAddress(fake_bus, "conn", "path")
 
34
        dict(addr=object())
 
35
 
 
36
    def test_equality_operator(self):
 
37
        fake_bus = object()
 
38
        addr1 = DBusAddress(fake_bus, "conn", "path")
 
39
 
 
40
        self.assertThat(addr1, Equals(DBusAddress(fake_bus, "conn", "path")))
 
41
        self.assertThat(addr1, Not(Equals(DBusAddress(fake_bus, "conn", "new_path"))))
 
42
        self.assertThat(addr1, Not(Equals(DBusAddress(fake_bus, "conn2", "path"))))
 
43
        self.assertThat(addr1, Not(Equals(DBusAddress(object(), "conn", "path"))))
 
44
 
 
45
    def test_inequality_operator(self):
 
46
        fake_bus = object()
 
47
        addr1 = DBusAddress(fake_bus, "conn", "path")
 
48
 
 
49
        self.assertThat(addr1, Not(NotEquals(DBusAddress(fake_bus, "conn", "path"))))
 
50
        self.assertThat(addr1, NotEquals(DBusAddress(fake_bus, "conn", "new_path")))
 
51
        self.assertThat(addr1, NotEquals(DBusAddress(fake_bus, "conn2", "path")))
 
52
        self.assertThat(addr1, NotEquals(DBusAddress(object(), "conn", "path")))