示例#1
0
    def test_install_new_zip(self):
        """Install a ZIP"""

        data_file = testutils.DataFile("integration_pm_valid_zip.zip")

        rtn = self.run_cmd("pm install --zip %s" % str(data_file))
        assert (rtn.return_code == 0)
示例#2
0
def test_aapt():
    """Run test aapt command"""
    data_file = testutils.DataFile("hello-world.apk")

    stdout, stderr, rtn = included.aapt("d badging %s" % str(data_file))

    assert rtn == 0
示例#3
0
    def test_install_single_binary(self):
        """Install a single binary"""

        data_file = testutils.DataFile("integration_pm_binary_install")

        rtn = self.run_cmd("pm install --single binary --name %s" %
                           str(data_file))
        assert (rtn.return_code == 0)
示例#4
0
    def test_install_single_module_bash(self):
        """Install a single module"""

        data_file = testutils.DataFile("integration_pm_module_install_bash")

        rtn = self.run_cmd("pm install --single module --name %s" %
                           str(data_file))
        assert (rtn.return_code == 0)
示例#5
0
    def test_install_single_binary_auto(self):
        """Attempt to install binary, but try auto"""

        data_file = testutils.DataFile("integration_pm_binary_install")

        rtn = self.run_cmd("pm install --auto --single binary --name %s" %
                           str(data_file))
        assert (rtn.return_code == 252)
示例#6
0
    def test_install_manual_version(self):
        """Attempt to install module with bad version"""

        data_file = testutils.DataFile("integration_pm_module_install_bash")

        rtn = self.run_cmd(
            "pm install --version BAD --single module --name %s" %
            str(data_file))
        assert (rtn.return_code == 251)
示例#7
0
def test_apktool():
    """Run test apktool command"""

    data_file = testutils.DataFile("hello-world.apk")

    stdout, stderr, rtn = included.apktool("d %s" % str(data_file))

    utils.delete_tree("hello-world")

    assert rtn == 0
示例#8
0
    def test_delete_package(self):
        """Delete a package"""

        data_file = testutils.DataFile("integration_pm_valid_zip.zip")

        rtn = self.run_cmd("pm install --zip %s" % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("pm delete --name HelloWorld_app --type package",
                           input_data="y\n")
        assert (rtn.return_code == 0)
示例#9
0
    def test_delete_library(self):
        """Delete a library"""

        data_file = testutils.DataFile("integration_pm_valid_zip.zip")

        rtn = self.run_cmd("pm install --zip %s" % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("pm delete --name Utils --type library",
                           input_data="y\n")
        assert (rtn.return_code == 0)
示例#10
0
def test_axmlprinter2():
    """Run test axmlprinter2 command"""

    data_file = testutils.DataFile("valid_android_manifest.xml")
    out_file = "out.xml"

    rtn = included.axmlprinter2(str(data_file), out_file)

    utils.delete_file(out_file)

    assert rtn == 0
示例#11
0
    def test_upload(self):
        """Do an upload"""

        data_file = testutils.DataFile("integration_client_upload_data")

        rtn = self.run_cmd("client upload %s" % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd(
            "client execute \"rm %s/integration_client_upload_data\"" %
            PATH_TO_DTF_DATA)
        assert (rtn.return_code == 0)
示例#12
0
    def test_valid_python_wrong_sub(self):
        """Run module with not existant subcmd"""

        data_file = testutils.DataFile("integration_module_valid_subs")

        rtn = self.run_cmd(
            "pm install --force --single module --install_name test_sub --name %s --auto"
            % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("test_sub nope")

        assert (rtn.return_code == 241)
示例#13
0
    def test_valid_python_execute(self):
        """Run module with default execute"""

        data_file = testutils.DataFile("integration_module_valid_mod")

        rtn = self.run_cmd(
            "pm install --force --single module --install_name test_execute --name %s --auto"
            % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("test_execute")

        assert (rtn.return_code == 0)
示例#14
0
    def test_invalid_python_no_exec_zero_args(self):
        """Attempt to run module with no args or exec"""

        data_file = testutils.DataFile("integration_module_invalid_noexecargs")

        rtn = self.run_cmd(
            "pm install --force --single module --install_name test_noexecargs --name %s --auto"
            % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("test_noexecargs test")

        assert (rtn.return_code == 242)
示例#15
0
    def test_real_export(self):
        """Perform an export"""

        data_file = testutils.DataFile("integration_pm_valid_zip.zip")

        rtn = self.run_cmd("pm install --zip %s" % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("pm export test.zip")
        assert (rtn.return_code == 0)
        assert (os.path.isfile("test.zip"))

        utils.delete_file("test.zip")
示例#16
0
def test_smali():
    """Run test smali/baksmali command"""

    data_file = testutils.DataFile("hello-world.apk")

    stdout, stderr, rtn_bak = included.baksmali("-o out %s" % str(data_file))
    stdout, stderr, rtn_smali = included.smali("-o classes.dex out")

    utils.delete_tree("out")
    utils.delete_file("classes.dex")

    assert rtn_bak == 0
    assert rtn_smali == 0
示例#17
0
    def test_upload_not_installed(self):
        """Attempt to upload with non-existent APK"""

        rtn = self.run_cmd("client remove")
        assert (rtn.return_code == 0)

        data_file = testutils.DataFile("integration_client_upload_data")

        rtn = self.run_cmd("client upload %s" % str(data_file))
        assert (rtn.return_code == 255)

        rtn = self.run_cmd("client install")
        assert (rtn.return_code == 0)
示例#18
0
    def test_valid_python_raise_kb_exception(self):
        """Run module and immediately raise a keyboard exception"""

        data_file = testutils.DataFile("integration_module_valid_kraise")

        rtn = self.run_cmd(
            "pm install --force --single module --install_name test_kraise --name %s --auto"
            % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("test_kraise test")

        assert (rtn.return_code == 245)
示例#19
0
    def test_upload_path(self):
        """Do an upload to a path"""

        data_file = testutils.DataFile("integration_client_upload_data")

        rtn = self.run_cmd(
            "client upload --path /data/data/com.dtf.client/test %s" %
            str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd(
            "client execute \"rm %s/integration_client_upload_data\"" %
            PATH_TO_DTF_DATA)
        assert (rtn.return_code == 0)
示例#20
0
    def test_all_valid(self):
        """Print all types, with actual installed content"""

        data_file = testutils.DataFile("integration_pm_valid_zip.zip")

        rtn = self.run_cmd("pm install --zip %s" % str(data_file))
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("pm list")
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("pm list -v")
        assert (rtn.return_code == 0)

        rtn = self.run_cmd("pm list -q")
        assert (rtn.return_code == 0)