~ubuntu-branches/ubuntu/natty/mago/natty

« back to all changes in this revision

Viewing changes to software_center/software_center.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2010-12-03 16:08:32 UTC
  • Revision ID: james.westby@ubuntu.com-20101203160832-97pz2nxwmo54iwfk
Tags: 0.3-0ubuntu3
* Updated from trunk
 + Added new applications to our tests base
 + Fixes LP: #682845 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
import os
 
3
from time import time, gmtime, strftime
 
4
 
 
5
from mago.test_suite.software_center import Software_centerTestSuite 
 
6
 
 
7
class Software_center(Software_centerTestSuite):
 
8
    def search_software(self, package, oracle):
 
9
        """ Do a package search """
 
10
 
 
11
        self.application.search_package(package)
 
12
        content = self.application.getpackagelistrow(0)
 
13
 
 
14
        if oracle not in content:
 
15
            raise AssertionError("Package '%s' should be displayed on the first row" % package)
 
16
 
 
17
    def install_software(self, package, oracle, password):
 
18
        """ Install a package """
 
19
 
 
20
        # TODO: Check if the package is already installed and cancel if it is
 
21
        self.application.set_password(password)
 
22
        self.application.install_or_remove_package("install", package)
 
23
 
 
24
        # Check if the package has been correctly installed
 
25
        content = self.application.getpackagelistrow(0)
 
26
        if oracle not in content:
 
27
            raise AssertionError("Package '%s' not installed" % package)
 
28
 
 
29
    def remove_software(self, package, oracle, password):
 
30
        """ Remove a package """
 
31
 
 
32
        # TODO: Check if the package is not already installed and cancel if it is
 
33
        self.application.set_password(password)
 
34
        self.application.install_or_remove_package("remove", package)
 
35
 
 
36
        # Check if the package has been correctly uninstalled
 
37
        content = self.application.getpackagelistrow(0)
 
38
        if oracle not in content:
 
39
            raise AssertionError("Package '%s' not uninstalled" % package)
 
40
 
 
41
 
 
42
if __name__ == "__main__":
 
43
    software_center_test =  Software_center()
 
44
    software_center_test.run()