Пример #1
0
class TestClientOperations(unittest.TestCase):

    # FYI: overriding this constructor is apparently not recommended, so we should find a better way to init test data
    def __init__(self, *args, **kwargs): 
        super(TestClientOperations, self).__init__(*args, **kwargs) 
        self.username = test_helper.get_creds()['username']
        self.password = test_helper.get_creds()['password']
        self.org_type = test_helper.get_creds()['org_type']
        self.client = MavensMateClient(credentials={
            "username" : self.username,
            "password" : self.password,
            "org_type" : self.org_type
        })

    def setUp(self):
        pass

    def test_describe(self):
        print self.client.describeMetadata(retXml=False)

    def test_bad_login(self):
        try:
            self.client = MavensMateClient(credentials={"username":self.username, "password":"******"}) 
        except BaseException, e:
            self.assertTrue(e.message == 'Server raised fault: \'INVALID_LOGIN: Invalid username, password, security token; or user locked out.\'')
Пример #2
0
class TestClientOperations(unittest.TestCase):

    # FYI: overriding this constructor is apparently not recommended, so we should find a better way to init test data
    def __init__(self, *args, **kwargs):
        super(TestClientOperations, self).__init__(*args, **kwargs)
        self.username = test_helper.get_creds()['username']
        self.password = test_helper.get_creds()['password']
        self.org_type = test_helper.get_creds()['org_type']
        self.client = MavensMateClient(
            credentials={
                "username": self.username,
                "password": self.password,
                "org_type": self.org_type
            })

    def setUp(self):
        pass

    def test_describe(self):
        print self.client.describeMetadata(retXml=False)

    def test_bad_login(self):
        try:
            self.client = MavensMateClient(credentials={
                "username": self.username,
                "password": "******"
            })
        except BaseException, e:
            self.assertTrue(
                e.message ==
                'Server raised fault: \'INVALID_LOGIN: Invalid username, password, security token; or user locked out.\''
            )
Пример #3
0
    def run(self):
        try:
            if 'password' not in self.destination:
                self.destination['password'] = util.get_password_by_key(self.destination['id'])
            deploy_client = MavensMateClient(credentials={
                "username":self.destination['username'],
                "password":self.destination['password'],
                "org_type":self.destination['org_type']
            })    

            # Check testRequired to find out if this is a production org.
            # This is a bit of a misnomer as runAllTests=True will run managed package tests, other 
            # tests are *always* run so we should honor the UI, however Production orgs do require 
            # rollbackOnError=True so we should override it here
            describe_result = deploy_client.describeMetadata(retXml=False)
            if describe_result.testRequired == True:
                self.params['rollback_on_error'] = True

            self.params['zip_file'] = self.deploy_metadata.zipFile      
            deploy_result = deploy_client.deploy(self.params)
            deploy_result['username'] = self.destination['username']
            debug('>>>>>> DEPLOY RESULT >>>>>>')
            debug(deploy_result)
            self.result = deploy_result
        except BaseException, e:
            result = util.generate_error_response(e.message, False)
            result['username'] = self.destination['username']
            self.result = result