Exemple #1
0
    def test_get_resources_of_type(self):
        """ Test for get_resources_of_type method."""
        test = memoQResource.MemoQResource()

        self.assertEqual(
            test.get_resources_of_type(self.config["wrong_resource_type"]), None, "Lookup for wrong type should return none!")

        self.assertNotEqual(test.get_resources_of_type(
            self.config["valid_resource_type"]), None, "Lookup for valid type shouldn't return none!")
Exemple #2
0
    def test_valid_type(self):
        """ Test for valid_type method."""
        test = memoQResource.MemoQResource()

        self.assertFalse(
            test.valid_type(self.config["wrong_resource_type"]), "Wrong type should return false!")

        self.assertTrue(
            test.valid_type(self.config["valid_resource_type"]), "Valid type should return true!")
Exemple #3
0
    def test_download_resource(self):
        """ Test for download_resource method."""
        test = memoQResource.MemoQResource()
        test.set_active_resource(self.config["valid_resource_guid"],
                                 self.config["valid_resource_type"])

        file_path = test.download_resource(".")
        self.assertTrue(os.path.isfile(file_path), "File should exist!")

        os.remove(file_path)
Exemple #4
0
    def test_set_type(self):
        """ Test for set_type method."""
        test = memoQResource.MemoQResource()

        test.set_type(self.config["wrong_resource_type"])
        self.assertEqual(
            test.get_type(), None, "Setting wrong type succeeded!")

        test.set_type(self.config["valid_resource_type"])
        self.assertNotEqual(
            test.get_type(), None, "Setting valid type failed!")
Exemple #5
0
    def test_get_all_resources(self):
        """ Test for get_all_resources method."""
        test = memoQResource.MemoQResource()
        test.set_active_resource(self.config["valid_resource_guid"],
                                 self.config["valid_resource_type"])

        resources = test.get_all_resources()
        self.assertTrue(len(resources),
                        "List of resources shouldn't be empty!")

        self.assertTrue(len([x for x in resources if x[1].Guid == test.info.Guid and x[1].Name == test.info.Name]),
                        "List should contain our valid resource!")
Exemple #6
0
    def test_set_active_resource(self):
        """ Test for get_project_by_domain method."""
        test = memoQResource.MemoQResource()

        test.set_active_resource(self.config["wrong_resource_guid"],
                                 self.config["valid_resource_type"])
        self.assertEqual(
            test.info, None, "Setting active resource with wrong guid \
            and valid type should return none!")

        test.set_active_resource(self.config["valid_resource_guid"],
                                 self.config["wrong_resource_type"])
        self.assertEqual(
            test.info, None, "Setting active resource with valid guid \
            and wrong type should return none!")

        test.set_active_resource(self.config["valid_resource_guid"],
                                 self.config["valid_resource_type"])
        self.assertNotEqual(
            test.info, None, "Setting active resource with valid guid \
            and type shouldn't return none!")